protected virtual void attack(HittableTarget target, Boolean isMelee, Castle enemy)
 {
     if (canAttackType == CharacterEnums.EType.BOTH || canAttackType == target.myType || target.myType == CharacterEnums.EType.BOTH)
     {
         attackCounter++;
         if (attackCounter >= getAttackCount())
         {
             attackCounter = 0;
             if (isMelee)
             {
                 Logger.d(ToString() + " attacked " + target.ToString() + "(Melee " + getMeleeDamage() + " dmg)");
                 if (splashRange == 0)
                 {
                     target.getHit(getMeleeDamage());
                 }
                 else
                 {
                     enemy.hitForSplash(getMeleeDamage(), splashRange, canAttackType);
                 }
             }
             else
             {
                 Logger.d(ToString() + " attacked " + target.ToString() + "(Ranged " + getRangedDamage() + " dmg)");
                 if (splashRange == 0)
                 {
                     target.getHit(getRangedDamage());
                 }
                 else
                 {
                     enemy.hitForSplash(getRangedDamage(), splashRange, canAttackType);
                 }
             }
         }
     }
 }
Example #2
0
        public string details()
        {
            String details = ToString();

            details += "\n\tMoney: $" + getMoney() + " Health: " + (int)(healthBar.health) + "hp";
            details += "\n\tfront air target: " + airFrontTarget.ToString();
            details += "\n\tfront ground target: " + groundFrontTarget.ToString();
            details += "\n\tmelee: " + upgrader.spawn(ECharacterType.MELEE).ToString();
            details += "\n\trange: " + upgrader.spawn(ECharacterType.RANGED).ToString();
            details += "\n\tair  : " + upgrader.spawn(ECharacterType.SPECIAL).ToString();
            details += "\n\t" + characterTotals.ToString();
            return(details);
        }