Beispiel #1
0
        public void HandleTurn(SkillInstance skill)
        {
            Global.GameLoop.DecrementAffects(CurrentTurn, TimerType.Round);
            for (int i = 0; i <= Global.RoundDuration; i++)
            {
                Global.GameLoop.DecrementAffects(CurrentTurn, TimerType.Pulse);
            }
            CurrentTurn.Skills["Autoattack"].Skill.Action(CurrentTurn, "");
            skill.Skill.Action(CurrentTurn, skill.Arguments);
            if (!SetNextTurn())
                return;

            if (CurrentTurn is Mob)
            {
                SkillInstance[] rolltable = new SkillInstance[1000];
                int index = 0;
                int startIndex = 0;
                foreach (SkillInstance skillInstanceT in CurrentTurn.SkillSlots)
                {
                    for(index = index; index < startIndex + skillInstanceT.AI.RandomWeight; index++)
                        rolltable[index] = skillInstanceT;

                    startIndex = index;
                }
                for (index = index; index <= 999; index++)
                    rolltable[index] = CurrentTurn.Skills["Autoattack"];

                int roll = Combat.Random.Next(0, 999);
                SkillInstance skillInstance = rolltable[roll];

                if (skillInstance != CurrentTurn.Skills["Autoattack"])
                    CurrentTurn.Skills["Autoattack"].Skill.Action(CurrentTurn, "");
                skillInstance.Skill.Action(CurrentTurn, "");
            }

            if (!SetNextTurn())
                return;
        }
Beispiel #2
0
        public void Load(XmlNode mob)
        {
            IndexNumber = Convert.ToInt32(mob.Attributes["index"].Value);

            if (mob.Attributes["hp"].Value != "")
                MaxHealth = Convert.ToInt32(mob.Attributes["hp"].Value);
            if (mob.Attributes["exp"].Value != "")
                ExperienceReward = Convert.ToInt32(mob.Attributes["exp"].Value);
            if (mob.Attributes["coins"].Value != "")
                Coins = Convert.ToInt32(mob.Attributes["coins"].Value);
            if (mob.Attributes["physicalpower"].Value != "")
                PhysicalPower = Convert.ToInt32(mob.Attributes["physicalpower"].Value);
            if (mob.Attributes["magicpower"].Value != "")
                MagicPower = Convert.ToInt32(mob.Attributes["magicpower"].Value);

            Name = mob["name"].InnerText;
            HandlingName = mob["handlingname"].InnerText;
            Description = mob["desc"].InnerText;
            RoomDescription = mob["roomdesc"].InnerText;

            Health = MaxHealth;

            foreach (XmlNode skillNode in mob["skills"].ChildNodes)
            {
                Skill skill = Global.SkillTable[skillNode.Attributes["name"].Value];
                SkillInstance skillInstance = new SkillInstance(skill, new SkillAI());
                XmlNode skillAInode = skillNode["skillai"];
                skillInstance.AI.RandomWeight = Convert.ToInt32(skillAInode.Attributes["randomweight"].Value);
                Skills.Add(skillInstance.Skill.Name, skillInstance);
                SkillSlots.Add(skillInstance);
            }

            Global.Log("    Mob: " + Name + " with ID #" + IndexNumber + "\n");
        }