Example #1
0
        public override void Process(IBattleEntity attacker, IBattleEntity target)
        {
            float             hitprobability = MathCore.Sigmoid(GetModifiedDexterity(attacker) - target.Dexterity, 1.1f, 0.68f);
            RPGMessageBuilder message        = context.GetModule <RPGMessageModule>().Create().BattleActor(attacker).Text(" tries to bite ").BattleActor(target);

            if (RNG.XORShift64.NextFloat() < hitprobability)
            {
                int hp = Math.Min(target.HP, (int)(target.MaxHP * (0.1 + 0.05 * Level)));
                message.Text(", sucks on him and heals").Health(attacker.Heal(hp)).Text(".");
                target.Hit(hp);
            }
            else
            {
                message.Text(" but fails miserably.");
            }
            message.Send();
        }