private void assertToHitDataEquals(final ToHitData expected, final Object actual) { Assert.assertNotNull(actual); Assert.assertTrue("actual: " + actual.getClass().getName(), actual instanceof ToHitData); final ToHitData actualTHD = (ToHitData) actual; final StringBuilder failure = new StringBuilder(); if (expected.getValue() != actualTHD.getValue()) { failure.append("\nExpected: ").append(expected.getValue()); failure.append("\nActual: ").append(actualTHD.getValue()); } final Set<TargetRollModifier> expectedMods = new HashSet<>(expected.getModifiers()); final Set<TargetRollModifier> actualMods = new HashSet<>(actualTHD.getModifiers()); if (!expectedMods.equals(actualMods)) { failure.append("\nExpected: ").append(expected.getDesc()); failure.append("\nActual: ").append(actualTHD.getDesc()); } if (!StringUtil.isNullOrEmpty(failure.toString())) { Assert.fail(failure.toString()); } }
Entity.LOC_NONE, IAimingModes.AIM_MODE_NONE, true); toHitBuff.append(t.getShortName() + ": "); toHitBuff.append(toHit.getDesc()); toHitBuff.append("\n"); if (m.getType().hasFlag(WeaponType.F_AUTO_TARGET) Entity.LOC_NONE, IAimingModes.AIM_MODE_NONE, true); toHitBuff.append(t.getDisplayName() + ": "); toHitBuff.append(toHit.getDesc()); toHitBuff.append("\n"); setFireEnabled(false); if (toHitBuff.length() < 1) { toHitBuff.append(toHit.getDesc());
@Override public boolean handle(IGame.Phase phase, Vector<Report> vPhaseReport) { Entity entityTarget = (Entity) target; // ... but only as their *only* attack action. if (toHit.getValue() == TargetRoll.IMPOSSIBLE) { Report r = new Report(3105); r.subject = subjectId; r.add(toHit.getDesc()); vPhaseReport.addElement(r); return false; } // swarming ended succesfully Report r = new Report(3110); r.subject = subjectId; vPhaseReport.addElement(r); // Only apply the "stop swarm 'attack'" to the swarmed Mek. if (ae.getSwarmTargetId() != target.getTargetId()) { Entity other = game.getEntity(ae.getSwarmTargetId()); other.setSwarmAttackerId(Entity.NONE); } else { entityTarget.setSwarmAttackerId(Entity.NONE); } ae.setSwarmTargetId(Entity.NONE); return false; } }
private void explosives() { ToHitData explo = LayExplosivesAttackAction.toHit(clientgui.getClient() .getGame(), cen, target); String title = Messages.getString( "PhysicalDisplay.LayExplosivesAttackDialog.title", new Object[] { target.getDisplayName() }); //$NON-NLS-1$ String message = Messages .getString( "PhysicalDisplay.LayExplosivesAttackDialog.message", new Object[] {//$NON-NLS-1$ explo.getValueAsString(), new Double(Compute.oddsAbove(explo.getValue())), explo.getDesc() }); if (clientgui.doYesNoDialog(title, message)) { disableButtons(); attacks.addElement(new LayExplosivesAttackAction(cen, target .getTargetType(), target.getTargetId())); ready(); } }
r = new Report(3135); r.subject = subjectId; r.add(toHit.getDesc()); vPhaseReport.addElement(r); return false; r.newlines = 0; r.subject = subjectId; r.add(toHit.getDesc()); vPhaseReport.addElement(r); } else if (toHit.getValue() == TargetRoll.AUTOMATIC_SUCCESS) { r.newlines = 0; r.subject = subjectId; r.add(toHit.getDesc()); vPhaseReport.addElement(r);
ret += "Incorrect To Hit prediction, physical attack " + attackType.name() + ":\n"; ret += " Guess: " + Integer.toString(guessInfo.getHitData().getValue()) + " " + guessInfo.getHitData() .getDesc() + "\n"; ret += " Real: " + Integer.toString(accurateInfo.getHitData().getValue()) + " " + accurateInfo.getHitData().getDesc() + "\n";
setFireEnabled(true); clientgui.mechD.wPan.toHitText.setText(toHit.getDesc()); setSkipEnabled(true); } else {
private void breakGrapple() { ToHitData toHit = BreakGrappleAttackAction.toHit(clientgui.getClient() .getGame(), cen, target); String title = Messages.getString( "PhysicalDisplay.BreakGrappleDialog.title", new Object[] { target.getDisplayName() }); //$NON-NLS-1$ String message = Messages .getString( "PhysicalDisplay.BreakGrappleDialog.message", new Object[] { //$NON-NLS-1$ toHit.getValueAsString(), new Double( Compute.oddsAbove( toHit.getValue(), ce().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING))), toHit.getDesc() }); if (clientgui.doYesNoDialog(title, message)) { disableButtons(); // declare searchlight, if possible if (GUIPreferences.getInstance().getAutoDeclareSearchlight()) { doSearchlight(); } attacks.addElement(new BreakGrappleAttackAction(cen, target .getTargetType(), target.getTargetId())); ready(); } }
/** * slice 'em up with your vibroclaws */ public void vibroclawatt() { BAVibroClawAttackAction act = new BAVibroClawAttackAction(cen, target.getTargetType(), target.getTargetId()); ToHitData toHit = act.toHit(clientgui.getClient().getGame()); String title = Messages .getString( "PhysicalDisplay.BAVibroClawDialog.title", new Object[] { target.getDisplayName() }); //$NON-NLS-1$ String message = Messages .getString( "PhysicalDisplay.BAVibroClawDialog.message", new Object[] {//$NON-NLS-1$ toHit.getValueAsString(), new Double( Compute.oddsAbove( toHit.getValue(), ce().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING))), toHit.getDesc(), ce().getVibroClaws() + toHit.getTableDesc() }); // Give the user to cancel the attack. if (clientgui.doYesNoDialog(title, message)) { disableButtons(); attacks.addElement(act); ready(); } }
/** * Trip that target! */ void trip() { ToHitData toHit = TripAttackAction.toHit(clientgui.getClient() .getGame(), cen, target); String title = Messages .getString( "PhysicalDisplay.TripDialog.title", new Object[] { target.getDisplayName() }); //$NON-NLS-1$ String message = Messages .getString( "PhysicalDisplay.TripDialog.message", new Object[] { //$NON-NLS-1$ toHit.getValueAsString(), new Double( Compute.oddsAbove( toHit.getValue(), ce().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING))), toHit.getDesc() }); if (clientgui.doYesNoDialog(title, message)) { disableButtons(); // declare searchlight, if possible if (GUIPreferences.getInstance().getAutoDeclareSearchlight()) { doSearchlight(); } attacks.addElement(new TripAttackAction(cen, target.getTargetType(), target.getTargetId())); ready(); } }
/** * Thrash at the target, unless the player cancels the action. */ void thrash() { ThrashAttackAction act = new ThrashAttackAction(cen, target.getTargetType(), target.getTargetId()); ToHitData toHit = act.toHit(clientgui.getClient().getGame()); String title = Messages .getString( "PhysicalDisplay.TrashDialog.title", new Object[] { target.getDisplayName() }); //$NON-NLS-1$ String message = Messages .getString( "PhysicalDisplay.TrashDialog.message", new Object[] {//$NON-NLS-1$ toHit.getValueAsString(), new Double( Compute.oddsAbove( toHit.getValue(), ce().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING))), toHit.getDesc(), ThrashAttackAction.getDamageFor(ce()) + toHit.getTableDesc() }); // Give the user to cancel the attack. if (clientgui.doYesNoDialog(title, message)) { disableButtons(); attacks.addElement(act); ready(); } }
/** * Push that target! */ void push() { ToHitData toHit = PushAttackAction.toHit(clientgui.getClient() .getGame(), cen, target); String title = Messages .getString( "PhysicalDisplay.PushDialog.title", new Object[] { target.getDisplayName() }); //$NON-NLS-1$ String message = Messages .getString( "PhysicalDisplay.PushDialog.message", new Object[] {//$NON-NLS-1$ toHit.getValueAsString(), new Double( Compute.oddsAbove( toHit.getValue(), ce().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING))), toHit.getDesc() }); if (clientgui.doYesNoDialog(title, message)) { disableButtons(); // declare searchlight, if possible if (GUIPreferences.getInstance().getAutoDeclareSearchlight()) { doSearchlight(); } attacks.addElement(new PushAttackAction(cen, target.getTargetType(), target.getTargetId(), target .getPosition())); ready(); } }
proto.getValue(), ce().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING))), proto.getDesc(), ProtomechPhysicalAttackAction.getDamageFor( ce(), target) + proto.getTableDesc() });
toHit.getValue(), ce().hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING))), toHit.getDesc(), damage }); if (clientgui.doYesNoDialog(title, message)) { disableButtons();
ce().hasAbility(OptionsConstants.PILOT_APTITUDE_GUNNERY)) + "%)"; str += " To Hit modifiers: " + toHit.getDesc();