📄 m_mutant.java
字号:
static int sound_step3; static int sound_thud; // // SOUNDS // static EntThinkAdapter mutant_step = new EntThinkAdapter() { public String getID(){ return "mutant_step"; } public boolean think(edict_t self) { int n; n = (Lib.rand() + 1) % 3; if (n == 0) GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_step1, 1, Defines.ATTN_NORM, 0); else if (n == 1) GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_step2, 1, Defines.ATTN_NORM, 0); else GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_step3, 1, Defines.ATTN_NORM, 0); return true; } }; static EntInteractAdapter mutant_sight = new EntInteractAdapter() { public String getID(){ return "mutant_sight"; } public boolean interact(edict_t self, edict_t other) { GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight, 1, Defines.ATTN_NORM, 0); return true; } }; static EntThinkAdapter mutant_search = new EntThinkAdapter() { public String getID(){ return "mutant_search"; } public boolean think(edict_t self) { GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search, 1, Defines.ATTN_NORM, 0); return true; } }; static EntThinkAdapter mutant_swing = new EntThinkAdapter() { public String getID(){ return "mutant_swing"; } public boolean think(edict_t self) { GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_swing, 1, Defines.ATTN_NORM, 0); return true; } }; // // STAND // static mframe_t mutant_frames_stand[] = new mframe_t[] { new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), // 10) new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), // 20) new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), // 30) new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), // 40) new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), // 50) new mframe_t(GameAI.ai_stand, 0, null) }; static mmove_t mutant_move_stand = new mmove_t(FRAME_stand101, FRAME_stand151, mutant_frames_stand, null); static EntThinkAdapter mutant_stand = new EntThinkAdapter() { public String getID(){ return "mutant_stand"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = mutant_move_stand; return true; } }; // // IDLE // static EntThinkAdapter mutant_idle_loop = new EntThinkAdapter() { public String getID(){ return "mutant_idle_loop"; } public boolean think(edict_t self) { if (Lib.random() < 0.75) self.monsterinfo.nextframe = FRAME_stand155; return true; } }; static mframe_t mutant_frames_idle[] = new mframe_t[] { new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), // scratch loop start new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, mutant_idle_loop), // scratch loop end new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null) }; static mmove_t mutant_move_idle = new mmove_t(FRAME_stand152, FRAME_stand164, mutant_frames_idle, mutant_stand); static EntThinkAdapter mutant_idle = new EntThinkAdapter() { public String getID(){ return "mutant_idle"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = mutant_move_idle; GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, Defines.ATTN_IDLE, 0); return true; } }; // // WALK // static mframe_t mutant_frames_walk[] = new mframe_t[] { new mframe_t(GameAI.ai_walk, 3, null), new mframe_t(GameAI.ai_walk, 1, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 10, null), new mframe_t(GameAI.ai_walk, 13, null), new mframe_t(GameAI.ai_walk, 10, null), new mframe_t(GameAI.ai_walk, 0, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 6, null), new mframe_t(GameAI.ai_walk, 16, null), new mframe_t(GameAI.ai_walk, 15, null), new mframe_t(GameAI.ai_walk, 6, null) }; static mmove_t mutant_move_walk = new mmove_t(FRAME_walk05, FRAME_walk16, mutant_frames_walk, null); static EntThinkAdapter mutant_walk_loop = new EntThinkAdapter() { public String getID(){ return "mutant_walk_loop"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = mutant_move_walk; return true; } }; static mframe_t mutant_frames_start_walk[] = new mframe_t[] { new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, -2, null), new mframe_t(GameAI.ai_walk, 1, null) }; static mmove_t mutant_move_start_walk = new mmove_t(FRAME_walk01, FRAME_walk04, mutant_frames_start_walk, mutant_walk_loop); static EntThinkAdapter mutant_walk = new EntThinkAdapter() { public String getID(){ return "mutant_walk"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = mutant_move_start_walk; return true; } }; // // RUN // static mframe_t mutant_frames_run[] = new mframe_t[] { new mframe_t(GameAI.ai_run, 40, null), new mframe_t(GameAI.ai_run, 40, mutant_step), new mframe_t(GameAI.ai_run, 24, null), new mframe_t(GameAI.ai_run, 5, mutant_step), new mframe_t(GameAI.ai_run, 17, null), new mframe_t(GameAI.ai_run, 10, null) }; static mmove_t mutant_move_run = new mmove_t(FRAME_run03, FRAME_run08, mutant_frames_run, null); static EntThinkAdapter mutant_run = new EntThinkAdapter() { public String getID(){ return "mutant_run"; } public boolean think(edict_t self) { if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) self.monsterinfo.currentmove = mutant_move_stand; else self.monsterinfo.currentmove = mutant_move_run; return true; } }; // // MELEE // static EntThinkAdapter mutant_hit_left = new EntThinkAdapter() { public String getID(){ return "mutant_hit_left"; } public boolean think(edict_t self) { float[] aim = { 0, 0, 0 }; Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8); if (GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit, 1, Defines.ATTN_NORM, 0); else GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_swing, 1, Defines.ATTN_NORM, 0); return true; } }; static EntThinkAdapter mutant_hit_right = new EntThinkAdapter() { public String getID(){ return "mutant_hit_right"; } public boolean think(edict_t self) { float[] aim = { 0, 0, 0 }; Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8); if (GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit2, 1, Defines.ATTN_NORM, 0); else GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_swing, 1, Defines.ATTN_NORM, 0); return true; } }; static EntThinkAdapter mutant_check_refire = new EntThinkAdapter() { public String getID(){ return "mutant_check_refire"; } public boolean think(edict_t self) { if (null == self.enemy || !self.enemy.inuse || self.enemy.health <= 0) return true; if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) self.monsterinfo.nextframe = FRAME_attack09; return true; } }; static mframe_t mutant_frames_attack[] = new mframe_t[] { new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, mutant_hit_left), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, mutant_hit_right), new mframe_t(GameAI.ai_charge, 0, mutant_check_refire) }; static mmove_t mutant_move_attack = new mmove_t(FRAME_attack09, FRAME_attack15, mutant_frames_attack, mutant_run); static EntThinkAdapter mutant_melee = new EntThinkAdapter() { public String getID(){ return "mutant_melee"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = mutant_move_attack; return true; } }; // // ATTACK // static EntTouchAdapter mutant_jump_touch = new EntTouchAdapter() { public String getID(){ return "mutant_jump_touch"; } public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) { if (self.health <= 0) { self.touch = null; return; } if (other.takedamage != 0) { if (Math3D.VectorLength(self.velocity) > 400) { float[] point = { 0, 0, 0 }; float[] normal = { 0, 0, 0 }; int damage; Math3D.VectorCopy(self.velocity, normal); Math3D.VectorNormalize(normal); Math3D.VectorMA(self.s.origin, self.maxs[0], normal, point); damage = (int) (40 + 10 * Lib.random()); GameCombat.T_Damage(other, self, self, self.velocity, point, normal, damage, damage, 0, Defines.MOD_UNKNOWN); } } if (!M.M_CheckBottom(self)) { if (self.groundentity != null) { self.monsterinfo.nextframe = FRAME_attack02; self.touch = null; } return; } self.touch = null;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -