Esempio n. 1
0
 public static MatchPreference PreferValidTargets(MudObject Actor, MudObject Object)
 {
     if (Object.HasProperty("health"))
     {
         return(MatchPreference.Likely);
     }
     return(MatchPreference.VeryUnlikely);
 }
Esempio n. 2
0
        public static List <MudObject> InitializeConversationTopics(this MudObject To)
        {
            if (!To.HasProperty("conversation-topics"))
            {
                To.SetProperty("conversation-topics", new List <MudObject>());
            }

            return(To.GetProperty <List <MudObject> >("conversation-topics"));
        }
Esempio n. 3
0
 private static void RememberActor(MudObject Player, MudObject Actor)
 {
     if (String.IsNullOrEmpty(Actor.Path))
     {
         return;                                   // Don't remember unimportant mobs.
     }
     if (!Player.HasProperty("introduction memory"))
     {
         Player.SetProperty("introduction memory", new Dictionary <string, bool>());
     }
     Player.GetProperty <Dictionary <String, bool> >("introduction memory").Upsert(Actor.Path, true);
 }
Esempio n. 4
0
        private static bool RecallActor(MudObject Player, MudObject Actor)
        {
            if (String.IsNullOrEmpty(Actor.Path))
            {
                return(false);                                  // Some mob.
            }
            if (!Player.HasProperty("introduction memory"))
            {
                return(false);
            }
            var memory = Player.GetProperty <Dictionary <String, bool> >("introduction memory");

            if (!memory.ContainsKey(Actor.Path))
            {
                return(false);
            }
            return(memory[Actor.Path]);
        }
Esempio n. 5
0
        public static void MeleeAttack(MudObject Attacker, MudObject Target)
        {
            if (!Target.HasProperty("combat health"))
            {
                return;
            }

            MudObject weapon = Attacker.GetProperty <MudObject>("combat weapon");

            if (weapon == null)
            {
                weapon          = GetDefaultWeapon();
                weapon.Location = Attacker;
            }

            var hitModifier = weapon.GetProperty <int>("combat hit modifier");
            var armorClass  = Target.GetProperty <int>("combat armor class");

            Core.SendMessage(Attacker, "Hit mod " + hitModifier + " vs AC " + armorClass);
            var hitRoll = Core.RollDice("1d20") + hitModifier;


            if (hitRoll == 20 || hitRoll >= armorClass)
            {
                var damageDie = weapon.GetProperty <String>("combat damage die");
                var damage    = Core.RollDice(damageDie);
                Core.SendMessage(Attacker, "Hit for (" + damageDie + ") - " + damage + " damage!");
                if (hitRoll == 20)
                {
                    var additionalDamage = Core.RollDice(damageDie);
                    Core.SendMessage(Attacker, "Critical! " + additionalDamage + " additional damage!");
                    damage += additionalDamage;
                }

                Core.SendLocaleMessage(Attacker, "^<0> hits ^<1> for " + damage + " damage!", Attacker, Target);
            }
            else
            {
                Core.SendMessage(Attacker, "@you miss", Attacker, Target);
                Core.SendLocaleMessage(Attacker, "@they miss", Attacker, Target);
            }
        }
Esempio n. 6
0
        public List <MudObject> GetObjects(PossibleMatch State, MatchContext Context)
        {
            MudObject source = null;

            if (!String.IsNullOrEmpty(LocutorArgument))
            {
                source = State[LocutorArgument] as MudObject;
            }
            else if (Context.ExecutingActor.HasProperty("interlocutor"))
            {
                source = Context.ExecutingActor.GetProperty <MudObject>("interlocutor");
            }

            if (source != null)
            {
                if (source.HasProperty("conversation-topics"))
                {
                    return(new List <MudObject>(source.GetProperty <List <MudObject> >("conversation-topics").Where(t => Core.GlobalRules.ConsiderCheckRuleSilently("topic available?", Context.ExecutingActor, source, t) == CheckResult.Allow)));
                }
            }

            return(new List <MudObject>());
        }