Esempio n. 1
0
 /// <summary>
 /// Applies the effect.
 /// </summary>
 /// <returns><c>true</c>, if effect was applied, <c>false</c> otherwise.</returns>
 /// <param name="p">P.</param>
 public bool ApplyEffect(PawnController p)
 {
     if (this.GetItemClass() == "Potion")
     {
         if (this.GetItemSubClass() == "HealPotion")
         {
             if (p.remainingHealth < p.totalHealth)
             {
                 p.GiveHealthAmount(this.GetHealEffect());
                 this.used = true;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else if (this.GetItemSubClass() == "ManaPotion")
         {
             if (p.remainingEnergy < p.totalEnergy)
             {
                 p.GiveEnergyAmount(this.GetManaMod());
                 this.used = true;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         // end potions
     }
     else if (this.GetItemClass() == "Magic")
     {
         if (p.CanUseEnergy(10))
         {
             if (this.GetItemSubClass() == "HealMagic")
             {
                 p.GiveHealthPercent((this.GetHealEffect() / 100f));
             }
             else if (this.GetItemSubClass() == "AttackMagic")
             {
                 // apply damage to player
                 p.SetDamage(this.GetAtkMod(), false);
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         Debug.Log("Unable to Apply Effect of " + this.itemName);
         return(false);
     }
     return(false);
 }