protected List<SButton> getAllOrderButtons(List<? extends Humanoid> selectedHumanoids) { Game kc = Rpg.getGame(); allOrderButtons.clear(); orders.clear(); orderTypes.clear(); if (selectedHumanoids == null) return allOrderButtons; for (LivingThing lt : selectedHumanoids) if (lt.getPossibleOrders() != null) orders.addAll(lt.getPossibleOrders()); List<? extends Humanoid> unitsOrdering = selectedHumanoids; OrderButton abButton; for (Order o : orders) { if (orderTypes.contains(o.getOrderType())) continue; abButton = OrderButton.getInstance(kc.getActivity(), o, null, unitsOrdering, ui.getSoldierOrders()); allOrderButtons.add(abButton); orderTypes.add(o.getOrderType()); } return allOrderButtons; }
@Override public void checkHit(@Nullable vector inDirection) { // System.out.println("MeleeAttack: checkHit() starting"); if (possibleVictum != null && owner.loc.distanceSquared(possibleVictum.loc) < Rpg.getMeleeAttackRangeSquared()) { possibleVictum.takeDamage(owner.getDamage(), owner); return; } if (inDirection != null) { checkHitHere.set(inDirection); checkHitHere.times(Rpg.getMeleeAttackRange()).add(owner.loc); // Log.d( "MeleeAttack" , "checkHit(): checkHitHere = " + checkHitHere); inThisArea.set(weaponStrikePercArea); inThisArea.offset(checkHitHere.x, checkHitHere.y); // Log.d( "MeleeAttack" , "inThisArea=" + inThisArea); // System.out.println("owner.getTeam()=" + owner.getTeam()); possibleVictum = cd.checkSingleHit(owner.getTeamName(), inThisArea); if (possibleVictum != null) { possibleVictum.takeDamage(owner.getDamage(), owner); if (weapon.wasDrawnThisFrame()) playHitSound(weaponType, owner.loc.x, owner.loc.y); } else { if (weapon.wasDrawnThisFrame()) playMissSound(weaponType, owner.loc.x, owner.loc.y); } } // System.out.println("MeleeAttack: checkHit() ending"); }
@Override public void setLoc(@NonNull vector v) { super.setLoc(v); updateArea(); // deployLoc.set(v); // deployLoc.add( 0 , area.height()/2 + Rpg.eightDp); }
public void takeDamage(int dam, LivingThing enemy, DamageTypes damageType, MM mm) { // Towers don't die in tower defence mode if (true) return; BuildingAnim bAnim = buildingAnim; if (bAnim == null) return; float prevHealthPerc = getLQ().getHealthPercent(); super.takeDamage(dam, enemy, damageType); float HealthPerc = getLQ().getHealthPercent(); if (prevHealthPerc > 0.90 && HealthPerc <= 0.90) bAnim.addDamagedEffect(1, mm); if (prevHealthPerc > 0.75 && HealthPerc <= 0.75) bAnim.addDamagedEffect(1, mm); if (prevHealthPerc > 0.6 && HealthPerc <= 0.6) bAnim.addDamagedEffect(1, mm); if (prevHealthPerc > 0.5 && HealthPerc <= 0.5) bAnim.addDamagedEffect(2, mm); if (prevHealthPerc > 0.35 && HealthPerc <= 0.35) bAnim.addDamagedEffect(3, mm); if (prevHealthPerc > 0.25 && HealthPerc <= 0.25) bAnim.addDamagedEffect(3, mm); if (prevHealthPerc > 0.15 && HealthPerc <= 0.15) bAnim.addDamagedEffect(3, mm); if (prevHealthPerc > 0 && HealthPerc <= 0) bAnim.addDamagedEffect(4, mm); }
protected List<SButton> getAllAbilityButtons(List<? extends Humanoid> selectedHumanoids) { Game kc = Rpg.getGame(); allAbilityButtons.clear(); abilities.clear(); abilitiesTypes.clear(); if (selectedHumanoids != null) for (LivingThing lt : selectedHumanoids) abilities.addAll(lt.getAbilities()); for (Ability ab : abilities) { if (abilitiesTypes.contains(ab.getAbility())) continue; AbilityButton abButton = AbilityButton.getInstance(kc.getActivity(), ab, ac); allAbilityButtons.add(abButton); abilitiesTypes.add(ab.getAbility()); } return allAbilityButtons; }
@Override public int calculateManaCost(@NotNull @NonNull LivingThing aWizard) { return 20 + aWizard.getLQ().getLevel() * 3; }
@Override public void setSelected(boolean b) { super.setSelected(b); }
public void checkHit(@Nullable LivingThing target) { if (target == null) return; if (owner.loc.distanceSquared(target.loc) < owner.getAQ().getAttackRangeSquared()) target.takeDamage(owner.getDamage(), owner); }