예제 #1
0
            public override bool Think(edict_t self)
            {
                self.s.origin[2] += 1;
                GameUtil.KillBox(self);
                self.solid        = Defines.SOLID_BBOX;
                self.movetype     = Defines.MOVETYPE_STEP;
                self.svflags     &= ~Defines.SVF_NOCLIENT;
                self.air_finished = GameBase.level.time + 12;
                GameBase.gi.Linkentity(self);
                Monster.Monster_start_go(self);
                if (self.enemy != null && 0 == (self.spawnflags & 1) && 0 == (self.enemy.flags & Defines.FL_NOTARGET))
                {
                    GameUtil.FoundTarget(self);
                }
                else
                {
                    self.enemy = null;
                }

                return(true);
            }
예제 #2
0
        public static void M_ReactToDamage(edict_t targ, edict_t attacker)
        {
            if ((null != attacker.client) && 0 != (attacker.svflags & Defines.SVF_MONSTER))
            {
                return;
            }
            if (attacker == targ || attacker == targ.enemy)
            {
                return;
            }
            if (0 != (targ.monsterinfo.aiflags & Defines.AI_GOOD_GUY))
            {
                if (attacker.client != null || (attacker.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0)
                {
                    return;
                }
            }

            if (attacker.client != null)
            {
                targ.monsterinfo.aiflags &= ~Defines.AI_SOUND_TARGET;
                if (targ.enemy != null && targ.enemy.client != null)
                {
                    if (GameUtil.Visible(targ, targ.enemy))
                    {
                        targ.oldenemy = attacker;
                        return;
                    }

                    targ.oldenemy = targ.enemy;
                }

                targ.enemy = attacker;
                if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED))
                {
                    GameUtil.FoundTarget(targ);
                }
                return;
            }

            if (((targ.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == (attacker.flags & (Defines.FL_FLY | Defines.FL_SWIM))) && (!(targ.classname.Equals(attacker.classname))) && (!(attacker.classname.Equals("monster_tank"))) && (!(attacker.classname.Equals("monster_supertank"))) && (!(attacker.classname.Equals("monster_makron"))) && (!(attacker.classname.Equals("monster_jorg"))))
            {
                if (targ.enemy != null && targ.enemy.client != null)
                {
                    targ.oldenemy = targ.enemy;
                }
                targ.enemy = attacker;
                if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED))
                {
                    GameUtil.FoundTarget(targ);
                }
            }
            else if (attacker.enemy == targ)
            {
                if (targ.enemy != null && targ.enemy.client != null)
                {
                    targ.oldenemy = targ.enemy;
                }
                targ.enemy = attacker;
                if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED))
                {
                    GameUtil.FoundTarget(targ);
                }
            }
            else if (attacker.enemy != null && attacker.enemy != targ)
            {
                if (targ.enemy != null && targ.enemy.client != null)
                {
                    targ.oldenemy = targ.enemy;
                }
                targ.enemy = attacker.enemy;
                if (0 == (targ.monsterinfo.aiflags & Defines.AI_DUCKED))
                {
                    GameUtil.FoundTarget(targ);
                }
            }
        }