Example #1
0
        //
        // Event Handlers
        //

        static void _GhostAttacked(object sender, CritterAttackedEventArgs e)
        {
            var ghost = sender as Critter;

            // regenerate HP
            ghost.Stat[Stats.CurrentHP] = ghost.Stat[Stats.MaxLife];

            // scream to scary player
            ghost.SayMsg(Say.ShoutOnHead, TextMsg.Dlg, TextMsg.DlgStr(Dialogs.Ghost, Str.Scream));

            // do nothing after attack
            e.PreventDefaults();
        }
Example #2
0
        /*
         * Handles stealing from ghost.
         * Stealing attempt fails in any case with a chance for player to cripple right hand.
         */
        static void _GhostStealing(object sender, CritterStealingEventArgs e)
        {
            var thief = e.Thief;

            if (thief.IsPlayer)
            {
                int injureHandChance = 20;
                int injureHandRoll   = Global.Random(1, 100);

                if (injureHandRoll <= injureHandChance)
                {
                    thief.Damage[Damages.RightArm] = 1;
                    thief.SayMsg(Say.NetMsg, TextMsg.Dlg, TextMsg.DlgStr(Dialogs.Ghost, Str.StealInjure));
                }
                else
                {
                    thief.SayMsg(Say.NetMsg, TextMsg.Dlg, TextMsg.DlgStr(Dialogs.Ghost, Str.Steal));
                }
            }
        }