Example #1
0
        public void InitCreatureCheck(GameWorld world)
        {
            AttackCheck = new AttackCheck();
            AttackCheck.CurrentCreature = this;
            AttackCheck.TimeInCS        = 200; //2 seconds
            AttackCheck.World           = world;
            world.AddEventInCS(AttackCheck.TimeInCS, AttackCheck.PerformCheck);

            FollowCheck = new FollowCheck();
            FollowCheck.CurrentCreature = this;
            FollowCheck.TimeInCS        = 30; //Change based on certain things
            FollowCheck.World           = world;
            world.AddEventInCS(FollowCheck.TimeInCS, FollowCheck.PerformCheck);

            TalkCheck = new TalkCheck();
            TalkCheck.CurrentCreature = this;
            TalkCheck.TimeInCS        = 49; //50
            TalkCheck.World           = world;
            world.AddEventInCS(TalkCheck.TimeInCS, TalkCheck.PerformCheck);

            SpellCheck = new SpellCheck();
            SpellCheck.CurrentCreature = this;
            SpellCheck.TimeInCS        = 51; //50
            SpellCheck.World           = world;
            world.AddEventInCS(SpellCheck.TimeInCS, SpellCheck.PerformCheck);
        }
Example #2
0
        //TODO: Completely rework this method... it currently sucks
        //A LOT... i mean it!
        public void CheckForRespawn()
        {
            Position pos     = new Position(CenterX, CenterY, CenterZ);
            Monster  monster = Monster.CreateMonster(MonsterName);

            if (monster != null && world.GetGameMap().GetTile(pos) != null)
            {
                world.AppendAddMonster(monster, pos);
            }
            return;

            Map      map  = world.GetGameMap();
            ThingSet tSet = map.GetThingsInVicinity(pos);

            //Monster monster = Monster.CreateMonster(MonsterName);
            if (monster == null)
            {
                return;
            }

            if (map.GetTile(pos) != null &&
                !map.TileContainsType(pos, Constants.TYPE_BLOCKS_AUTO_WALK))
            {
                bool canRespawn = true;
                foreach (Thing thing in tSet.GetThings())
                {
                    if (thing is Player)       //TODO: FIX this crap
                    {
                        canRespawn = false;
                    }
                }
                if (canRespawn)
                {
                    world.SendAddMonster(monster, pos);
                }
            }
            else
            {
                return;
            }

            //  if (map.GetTile(pos) != null &&
            // !map.TileContainsType(pos, Constants.TYPE_BLOCKS_AUTO_WALK)) {
            // Console.WriteLine("x: " + x++);
            //world.SendAddMonster(monster, pos);
            // }

            world.AddEventInCS(SpawnTime, CheckForRespawn);
        }
Example #3
0
        public void InitCreatureCheck(GameWorld world)
        {
            AttackCheck = new AttackCheck();
            AttackCheck.CurrentCreature = this;
            AttackCheck.TimeInCS = 200; //2 seconds
            AttackCheck.World = world;
            world.AddEventInCS(AttackCheck.TimeInCS, AttackCheck.PerformCheck);

            FollowCheck = new FollowCheck();
            FollowCheck.CurrentCreature = this;
            FollowCheck.TimeInCS = 30; //Change based on certain things
            FollowCheck.World = world;
            world.AddEventInCS(FollowCheck.TimeInCS, FollowCheck.PerformCheck);

            TalkCheck = new TalkCheck();
            TalkCheck.CurrentCreature = this;
            TalkCheck.TimeInCS = 49; //50
            TalkCheck.World = world;
            world.AddEventInCS(TalkCheck.TimeInCS, TalkCheck.PerformCheck);

            SpellCheck = new SpellCheck();
            SpellCheck.CurrentCreature = this;
            SpellCheck.TimeInCS = 51; //50
            SpellCheck.World = world;
            world.AddEventInCS(SpellCheck.TimeInCS, SpellCheck.PerformCheck);
        }