Exemple #1
0
    public override void AddToCurse(Deity self, Level level, Agent agent, StatusEffect curse)
    {
        var ox    = 0;
        var oy    = 0;
        var tries = 0;

        while (tries++ < 100 &&
               (level.GetTile(agent.X + ox, agent.Y + oy).BumpEffect != TileBumpEffect.None ||
                level.GetAgent(agent.X + ox, agent.Y + oy) != null))
        {
            ox = Globals.Random.Next(-5, 6);
            oy = Globals.Random.Next(-5, 6);
        }
        if (tries < 100)
        {
            var demon = level.Catalog.NewDemon(agent.X + ox, agent.Y + oy);
            curse.TurnsRemaining += 10;
            curse.AddEffect("hunted by a demon",
                            () => level.Add(demon),
                            () => { if (demon.HP > 0)
                                    {
                                        level.Remove(demon);
                                    }
                            });
        }
    }
Exemple #2
0
    public override IEnumerable <StatusEffect> GetBadInterventions(Deity self, Level level, Agent agent)
    {
        if (Globals.Random.Next(100) < -self.FavorPerTeam[agent.Team])
        {
            yield break;
        }

        var onFire = GetFire(agent);

        if (!agent.StatusEffects.Any(s => s.Name == onFire.Name))
        {
            var disliked = new StatusEffect {
                Name           = null,
                TurnsRemaining = 1
            };
            disliked.AddEffect(null,
                               () => {
                agent.Messages.Add($"[color={Globals.TextColorGood}]{self.Name}[/color] sets you on fire");
                onFire.Begin(level, agent);
            },
                               () => { });

            yield return(disliked);
        }
    }
Exemple #3
0
    public override void AddToCurse(Deity self, Level level, Agent agent, StatusEffect curse)
    {
        var summons    = new List <Agent>();
        var totalTries = 0;

        while (totalTries++ < 10 && summons.Count < 4)
        {
            var ox    = 0;
            var oy    = 0;
            var tries = 0;
            while (tries++ < 100 &&
                   (level.GetTile(agent.X + ox, agent.Y + oy).BumpEffect != TileBumpEffect.None ||
                    level.GetAgent(agent.X + ox, agent.Y + oy) != null))
            {
                ox = Globals.Random.Next(-5, 6);
                oy = Globals.Random.Next(-5, 6);
            }
            if (tries < 100)
            {
                summons.Add(level.Catalog.NewSkeleton(agent.X + ox, agent.Y + oy));
            }
        }
        if (summons.Any())
        {
            curse.AddEffect("hunted by skeletons",
                            () => summons.ForEach(s => level.Add(s)),
                            () => { });
        }
    }
Exemple #4
0
 public override IEnumerable <StatusEffect> GetGoodInterventions(Deity self, Level level, Agent agent)
 {
     if (Globals.Random.Next(100) < _chanceOfFire)
     {
         var fire = new StatusEffect {
             Name           = $"{self.Name}'s fiery protection",
             TurnsRemaining = 10
         };
         fire.AddEffect(null, () => { _chanceOfFire /= 2; }, () => {});
         fire.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)
                     {
                         var onFire = GetFire(other);
                         if (!other.StatusEffects.Any(e => e.Name == onFire.Name))
                         {
                             onFire.Begin(level, other);
                             agent.Messages.Add($"[color={Globals.TextColorGood}]{self.Name}[/color] sets {other.DisplayName} on fire");
                         }
                     }
                 }
             }
         });
         yield return(fire);
     }
 }
Exemple #5
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);
     }
 }
Exemple #6
0
 public override IEnumerable <StatusEffect> GetGoodInterventions(Deity self, Level level, Agent agent)
 {
     if (Globals.Random.Next(100) < _chanceOfItem)
     {
         var gift = new StatusEffect {
             Name           = null,
             TurnsRemaining = 1
         };
         gift.AddEffect(null,
                        () => {
             _chanceOfItem /= 2;
             var item       = level.Catalog.NewArmor(0, 0);
             item.DEF      += 1;
             var materials  = self.GetPreferredMaterials().ToArray();
             if (materials.Any())
             {
                 var material     = materials[Globals.Random.Next(materials.Length)];
                 item.MadeOf      = material;
                 item.DisplayName = $"{material} armor of {self.Name}";
             }
             else
             {
                 item.DisplayName = $"{item.DisplayName} of {self.Name}";
             }
             agent.Messages.Add($"[color={Globals.TextColorGood}]{self.Name}[/color] gives you a gift");
             new PickupItem().Do(level, agent, item);
         },
                        () => {});
         yield return(gift);
     }
 }
Exemple #7
0
 public override void AddToBlessing(Deity self, Level level, Agent agent, StatusEffect blessing)
 {
     if (agent.HP < agent.HPMax)
     {
         blessing.AddEffect("instant +HP",
                            () => { agent.HP++; },
                            () => { });
     }
 }
Exemple #8
0
    public override void AddToCurse(Deity self, Level level, Agent agent, StatusEffect curse)
    {
        curse.TurnsRemaining *= 2;

        if (agent.HP > agent.HPMax / 2)
        {
            curse.AddEffect("instant -HP",
                            () => { agent.HP--; },
                            () => { });
        }
    }
Exemple #9
0
    public StatusEffect MakeCurse(Level level, Agent agent)
    {
        var curse = new StatusEffect()
        {
            Name           = $"[color={Globals.TextColorBad}]{Name}'s curse[/color]",
            TurnsRemaining = 25
        };

        Archetype.AddToCurse(this, level, agent, curse);
        foreach (var domain in Domains)
        {
            domain.AddToCurse(this, level, agent, curse);
        }

        foreach (var deity in Globals.Deities)
        {
            if (deity.Likes.Contains(GetShortTitle()))
            {
                if (!deity.FavorPerTeam.ContainsKey(agent.Team))
                {
                    deity.FavorPerTeam[agent.Team] = 0;
                }
                curse.AddEffect($"instant -favor of {deity.Name}",
                                () => deity.FavorPerTeam[agent.Team] -= 3,
                                () => { });
            }
            if (deity.Dislikes.Contains(GetShortTitle()))
            {
                if (!deity.FavorPerTeam.ContainsKey(agent.Team))
                {
                    deity.FavorPerTeam[agent.Team] = 0;
                }
                curse.AddEffect($"instant +favor of {deity.Name}",
                                () => deity.FavorPerTeam[agent.Team] += 3,
                                () => { });
            }
        }

        return(curse);
    }
Exemple #10
0
    private StatusEffect GetFire(Agent target)
    {
        var onFire = new StatusEffect {
            Name           = "[color=#ff0000]On fire![/color]",
            TurnsRemaining = 3
        };

        onFire.AddEffect("-HP",
                         () => target.BeginFire(),
                         () => target.EndFire());
        onFire.AddTurnEffect(null, () => target.TakeDamage(1));
        return(onFire);
    }
Exemple #11
0
    public override IEnumerable <StatusEffect> GetGoodInterventions(Deity self, Level level, Agent agent)
    {
        var power = new StatusEffect {
            Name           = $"[color={Globals.TextColorGood}]{self.Name}'s[/color] power",
            TurnsRemaining = 10
        };

        power.AddEffect("+AP regen",
                        () => agent.APRegeneration += 5,
                        () => agent.APRegeneration -= 5);

        yield return(power);
    }
Exemple #12
0
    public override void AddToBlessing(Deity self, Level level, Agent agent, StatusEffect blessing)
    {
        blessing.AddAttackEffect("+ATK vs undead", a => {
            if (a.Defender.Team == "undead")
            {
                a.AttackBonus++;
            }
        });

        var amount = 5;

        blessing.AddEffect("+HP max",
                           () => { agent.HPMax += amount; agent.HP += amount; },
                           () => { agent.HPMax -= amount; agent.HP = Math.Min(agent.HP, agent.HPMax); });
    }
Exemple #13
0
 public override IEnumerable <StatusEffect> GetGoodInterventions(Deity self, Level level, Agent agent)
 {
     if (totalGiven < 25)
     {
         var gift = new StatusEffect {
             Name           = null,
             TurnsRemaining = 1
         };
         gift.AddEffect(null, () => {
             var amount   = 2 + Globals.Random.Next(5) + Globals.Random.Next(5);
             totalGiven  += amount;
             agent.Money += amount;
             agent.Messages.Add($"[color={Globals.TextColorGood}]{self.Name}[/color] gives you a gift of [color=#ffff33]${amount}[/color]");
         }, () => { });
         yield return(gift);
     }
 }
Exemple #14
0
 public override void AddToBlessing(Deity self, Level level, Agent agent, StatusEffect blessing)
 {
     blessing.AddEffect("instant +AP",
                        () => { agent.AP += 50; },
                        () => { });
 }
Exemple #15
0
 public override void AddToCurse(Deity self, Level level, Agent agent, StatusEffect curse)
 {
     curse.AddEffect("-AP regeneration",
                     () => { agent.APRegeneration -= 2; },
                     () => { agent.APRegeneration += 2; });
 }
Exemple #16
0
 public override void AddToBlessing(Deity self, Level level, Agent agent, StatusEffect blessing)
 {
     blessing.AddEffect("+AP regeneration",
                        () => { agent.APRegeneration += 3; },
                        () => { agent.APRegeneration -= 3; });
 }
Exemple #17
0
 public override void AddToCurse(Deity self, Level level, Agent agent, StatusEffect curse)
 {
     curse.AddEffect("instant -AP",
                     () => { agent.AP -= 20; },
                     () => { });
 }