コード例 #1
0
 public static void TakeDamage(this PlayerData player, Attack attack)
 {
     player.HP -= attack.HealthDamage;
     player.FP -= attack.FocusDamage;
     player.SP -= attack.StaminaDamage;
     if (attack.ExtraEffect != null)
     {
         attack.ExtraEffect(player);
     }
     attack.ExtraEffect = null;
     if (attack.Effects != null)
     {
         for (int i = 0; i < attack.Effects.Length; i++)
         {
             player.ApplyStatusEfect(attack.Effects[i]);
         }
     }
     if (player.HP <= 0 || player.SP <= 0 || player.FP <= 0)
     {
         player.IsAlive = false;
         player.Animate(true);
     }
     else
     {
         player.Animate(false);
     }
 }
コード例 #2
0
 public static void CriticalHit(this PlayerData player, Attack attack)
 {
     player.HP -= attack.HealthDamage * 2;
     player.FP -= attack.FocusDamage * 2;
     player.SP -= attack.StaminaDamage * 2;
     if (player.HP <= 0 || player.SP <= 0 || player.FP <= 0)
     {
         player.IsAlive = false;
         player.Animate(true);
     }
     else
     {
         player.Animate(false);
     }
 }
コード例 #3
0
 public static void PayCost(this PlayerData player, Attack attack)
 {
     player.HP -= attack.HealthCost;
     player.FP -= attack.FocusCost;
     player.SP -= attack.StaminaCost;
     if (player.HP <= 0 || player.SP <= 0 || player.FP <= 0)
     {
         player.IsAlive = false;
         player.Animate(true);
     }
 }