Exemple #1
0
 public override IEnumerable <StatusEffect> GetGoodInterventions(Deity self, Level level, Agent agent)
 {
     if (Globals.Random.Next(100) < _chanceOfStun)
     {
         var protection = new StatusEffect {
             Name           = $"[color={Globals.TextColorGood}]{self.Name}'s[/color] stunning protection",
             TurnsRemaining = 10
         };
         protection.AddEffect(null, () => { _chanceOfStun /= 2; }, () => {});
         protection.AddTurnEffect(null,
                                  () => {
             for (var ox = -2; ox < 3; ox++)
             {
                 for (var oy = -2; oy < 3; oy++)
                 {
                     var other = level.GetAgent(agent.X + ox, agent.Y + oy);
                     if (other != null &&
                         other != agent &&
                         other.StatusEffects.Any(e => e.Name == "Stunned"))
                     {
                         var stun = new StatusEffect {
                             Name           = "Stunned",
                             TurnsRemaining = 10
                         };
                         stun.AddTurnEffect("-AP", () => { other.AP -= 5; });
                         stun.Begin(level, other);
                         agent.Messages.Add($"[color={Globals.TextColorGood}]{self.Name}[/color] stuns {other.DisplayName}");
                     }
                 }
             }
         });
         yield return(protection);
     }
 }
 public void AddEffect(StatusEffect effect)
 {
     // check if effects already contains the effect, if it does just reset the lifetime
     // subscribe to the OnEnd event
     // otherwise add it
     effect.SetTarget(this.GetComponent <Monster>());
     effect.OnEnd += EffectEnd;
     effects.Add(effect);
     effect.Begin();
 }
Exemple #3
0
 public override void AddToBlessing(Deity self, Level level, Agent agent, StatusEffect blessing)
 {
     blessing.AddAttackEffect("stun attack", a => {
         var stun = new StatusEffect {
             Name           = "Stunned",
             TurnsRemaining = 10
         };
         stun.AddTurnEffect("-2d4 AP each turn", () => { agent.AP -= 2 + Globals.Random.Next(4) + Globals.Random.Next(4); });
         stun.Begin(level, a.Defender);
     });
 }
Exemple #4
0
 void AddStatusEffect(StatusEffect statusEffect)
 {
     statusEffect.Begin();
     statusEffects.Add(statusEffect);
 }