Exemple #1
0
 //#----------------------------------------------------------
 //# * Initialize
 //#----------------------------------------------------------
 public Effect_Missile(Game_BattleUnit unit, Point2DEx srcGridPt, Point2DEx startPt, int maxTick)
     : base(maxTick)
 {
     _bitmapName = unit.MissileBitmapName();
     _playerSide = unit.IsPlayerOwned;
     DamageAgent = unit.GetDamageAgent();
     _srcGridPt = srcGridPt;
     _startPt = startPt;
 }
Exemple #2
0
 //#----------------------------------------------------------
 //# * Execute Damage
 //#----------------------------------------------------------
 public int ExecuteDamage(Game_DamageAgent damageAgent)
 {
     int damage = damageAgent.Damage;
     if (Weakness == damageAgent.UnitClass) damage += damageAgent.ExtraDamage;
     this.HP -= damage;
     return damage;
 }
Exemple #3
0
 //#----------------------------------------------------------
 //# * Damage Handling
 //#----------------------------------------------------------
 private void DamageHandling(Game_DamageAgent damageAgent, Point2DEx pt)
 {
     Game_Unit targetUnit = GetTarget(pt);
     if (damageAgent.IsLegalAttackTarget(targetUnit))
     {
         PlaySound(damageAgent.SoundHit);
         int dealtDamage = targetUnit.ExecuteDamage(damageAgent);
         _effects.Add(new Effect_Text(dealtDamage.ToString(), Color.White, START_X + pt.X * 40, START_Y + pt.Y * 40 + 20, 30));
         if (targetUnit.IsDead() && targetUnit is Game_BattleUnit)
         {
             BreakConnections(pt); // break connections of unit
             if (targetUnit.IsPlayerOwned) UnitsLost++;
         }
     }
 }