Esempio n. 1
0
 public int throwPotion(Creature target)
 {
     int result = 0;
       try
       {
     result = this.effect.activate(target);
     return result;
       }
       catch (EffectException e)
       {
     return result;
       }
 }
Esempio n. 2
0
 public int drinkPotion(Creature drinker)
 {
     int result = 0;
       try
       {
     result = this.effect.activate(drinker);
     return result;
       }
       catch (EffectException e)
       {
     return result;
       }
 }
Esempio n. 3
0
        public override int activate(Creature target)
        {
            if (this.duration > 0)
            this.duration--;

              if (target.health != 0)
              {
            int initialHealth = target.health;
            int health = initialHealth - this.magnitude;
            target.health = Math.Max(health, 0);
            int diff = initialHealth - health;
            return diff;
              }
              else
            return 0;
        }
Esempio n. 4
0
        public override int activate(Creature target)
        {
            if (this.duration > 0)
            this.duration--;

              if (target.health < target.maxHealth)
              {
            int initialHealth = target.health;
            target.health = Math.Min((initialHealth + magnitude), target.maxHealth);
            int diff = target.health - initialHealth;

            return diff;
              }
              else
            throw new EffectException("Target has full health already!");
        }
Esempio n. 5
0
 public virtual int activate(Creature target)
 {
     //dummy method that should never be called
       return -5;
 }