📄 m_mutant.java
字号:
} }; static EntThinkAdapter mutant_jump_takeoff = new EntThinkAdapter() { public String getID(){ return "mutant_jump_takeoff"; } public boolean think(edict_t self) { float[] forward = { 0, 0, 0 }; GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight, 1, Defines.ATTN_NORM, 0); Math3D.AngleVectors(self.s.angles, forward, null, null); self.s.origin[2] += 1; Math3D.VectorScale(forward, 600, self.velocity); self.velocity[2] = 250; self.groundentity = null; self.monsterinfo.aiflags |= Defines.AI_DUCKED; self.monsterinfo.attack_finished = GameBase.level.time + 3; self.touch = mutant_jump_touch; return true; } }; static EntThinkAdapter mutant_check_landing = new EntThinkAdapter() { public String getID(){ return "mutant_check_landing"; } public boolean think(edict_t self) { if (self.groundentity != null) { GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_thud, 1, Defines.ATTN_NORM, 0); self.monsterinfo.attack_finished = 0; self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; return true; } if (GameBase.level.time > self.monsterinfo.attack_finished) self.monsterinfo.nextframe = FRAME_attack02; else self.monsterinfo.nextframe = FRAME_attack05; return true; } }; static mframe_t mutant_frames_jump[] = new mframe_t[] { new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 17, null), new mframe_t(GameAI.ai_charge, 15, mutant_jump_takeoff), new mframe_t(GameAI.ai_charge, 15, null), new mframe_t(GameAI.ai_charge, 15, mutant_check_landing), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 3, null), new mframe_t(GameAI.ai_charge, 0, null) }; static mmove_t mutant_move_jump = new mmove_t(FRAME_attack01, FRAME_attack08, mutant_frames_jump, mutant_run); static EntThinkAdapter mutant_jump = new EntThinkAdapter() { public String getID(){ return "mutant_jump"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = mutant_move_jump; return true; } }; // // CHECKATTACK // static EntThinkAdapter mutant_check_melee = new EntThinkAdapter() { public String getID(){ return "mutant_check_melee"; } public boolean think(edict_t self) { if (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE) return true; return false; } }; static EntThinkAdapter mutant_check_jump = new EntThinkAdapter() { public String getID(){ return "mutant_check_jump"; } public boolean think(edict_t self) { float[] v = { 0, 0, 0 }; float distance; if (self.absmin[2] > (self.enemy.absmin[2] + 0.75 * self.enemy.size[2])) return false; if (self.absmax[2] < (self.enemy.absmin[2] + 0.25 * self.enemy.size[2])) return false; v[0] = self.s.origin[0] - self.enemy.s.origin[0]; v[1] = self.s.origin[1] - self.enemy.s.origin[1]; v[2] = 0; distance = Math3D.VectorLength(v); if (distance < 100) return false; if (distance > 100) { if (Lib.random() < 0.9) return false; } return true; } }; static EntThinkAdapter mutant_checkattack = new EntThinkAdapter() { public String getID(){ return "mutant_checkattack"; } public boolean think(edict_t self) { if (null == self.enemy || self.enemy.health <= 0) return false; if (mutant_check_melee.think(self)) { self.monsterinfo.attack_state = Defines.AS_MELEE; return true; } if (mutant_check_jump.think(self)) { self.monsterinfo.attack_state = Defines.AS_MISSILE; // FIXME play a jump sound here return true; } return false; } }; // // PAIN // static mframe_t mutant_frames_pain1[] = new mframe_t[] { new mframe_t(GameAI.ai_move, 4, null), new mframe_t(GameAI.ai_move, -3, null), new mframe_t(GameAI.ai_move, -8, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 5, null) }; static mmove_t mutant_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain105, mutant_frames_pain1, mutant_run); static mframe_t mutant_frames_pain2[] = new mframe_t[] { new mframe_t(GameAI.ai_move, -24, null), new mframe_t(GameAI.ai_move, 11, null), new mframe_t(GameAI.ai_move, 5, null), new mframe_t(GameAI.ai_move, -2, null), new mframe_t(GameAI.ai_move, 6, null), new mframe_t(GameAI.ai_move, 4, null) }; static mmove_t mutant_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain206, mutant_frames_pain2, mutant_run); static mframe_t mutant_frames_pain3[] = new mframe_t[] { new mframe_t(GameAI.ai_move, -22, null), new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 1, null), new mframe_t(GameAI.ai_move, 1, null), new mframe_t(GameAI.ai_move, 6, null), new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 1, null) }; static mmove_t mutant_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain311, mutant_frames_pain3, mutant_run); static EntPainAdapter mutant_pain = new EntPainAdapter() { public String getID(){ return "mutant_pain"; } public void pain(edict_t self, edict_t other, float kick, int damage) { float r; if (self.health < (self.max_health / 2)) self.s.skinnum = 1; if (GameBase.level.time < self.pain_debounce_time) return; self.pain_debounce_time = GameBase.level.time + 3; if (GameBase.skill.value == 3) return; // no pain anims in nightmare r = Lib.random(); if (r < 0.33) { GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, Defines.ATTN_NORM, 0); self.monsterinfo.currentmove = mutant_move_pain1; } else if (r < 0.66) { GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, Defines.ATTN_NORM, 0); self.monsterinfo.currentmove = mutant_move_pain2; } else { GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, Defines.ATTN_NORM, 0); self.monsterinfo.currentmove = mutant_move_pain3; } } }; // // DEATH // static EntThinkAdapter mutant_dead = new EntThinkAdapter() { public String getID(){ return "mutant_dead"; } public boolean think(edict_t self) { Math3D.VectorSet(self.mins, -16, -16, -24); Math3D.VectorSet(self.maxs, 16, 16, -8); self.movetype = Defines.MOVETYPE_TOSS; self.svflags |= Defines.SVF_DEADMONSTER; GameBase.gi.linkentity(self); M.M_FlyCheck.think(self); return true; } }; static mframe_t mutant_frames_death1[] = new mframe_t[] { new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null) }; static mmove_t mutant_move_death1 = new mmove_t(FRAME_death101, FRAME_death109, mutant_frames_death1, mutant_dead); static mframe_t mutant_frames_death2[] = new mframe_t[] { new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null) }; static mmove_t mutant_move_death2 = new mmove_t(FRAME_death201, FRAME_death210, mutant_frames_death2, mutant_dead); static EntDieAdapter mutant_die = new EntDieAdapter() { public String getID(){ return "mutant_die"; } public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { int n; if (self.health <= self.gib_health) { GameBase.gi .sound(self, Defines.CHAN_VOICE, GameBase.gi .soundindex("misc/udeath.wav"), 1, Defines.ATTN_NORM, 0); for (n = 0; n < 2; n++) GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2", damage, Defines.GIB_ORGANIC); self.deadflag = Defines.DEAD_DEAD; return; } if (self.deadflag == Defines.DEAD_DEAD) return; GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1, Defines.ATTN_NORM, 0); self.deadflag = Defines.DEAD_DEAD; self.takedamage = Defines.DAMAGE_YES; self.s.skinnum = 1; if (Lib.random() < 0.5) self.monsterinfo.currentmove = mutant_move_death1; else self.monsterinfo.currentmove = mutant_move_death2; } }; // // SPAWN // /* * QUAKED monster_mutant (1 .5 0) (-32 -32 -24) (32 32 32) Ambush * Trigger_Spawn Sight */ public static EntThinkAdapter SP_monster_mutant = new EntThinkAdapter() { public String getID(){ return "SP_monster_mutant"; } public boolean think(edict_t self) { if (GameBase.deathmatch.value != 0) { GameUtil.G_FreeEdict(self); return false; } sound_swing = GameBase.gi.soundindex("mutant/mutatck1.wav"); sound_hit = GameBase.gi.soundindex("mutant/mutatck2.wav"); sound_hit2 = GameBase.gi.soundindex("mutant/mutatck3.wav"); sound_death = GameBase.gi.soundindex("mutant/mutdeth1.wav"); sound_idle = GameBase.gi.soundindex("mutant/mutidle1.wav"); sound_pain1 = GameBase.gi.soundindex("mutant/mutpain1.wav"); sound_pain2 = GameBase.gi.soundindex("mutant/mutpain2.wav"); sound_sight = GameBase.gi.soundindex("mutant/mutsght1.wav"); sound_search = GameBase.gi.soundindex("mutant/mutsrch1.wav"); sound_step1 = GameBase.gi.soundindex("mutant/step1.wav"); sound_step2 = GameBase.gi.soundindex("mutant/step2.wav"); sound_step3 = GameBase.gi.soundindex("mutant/step3.wav"); sound_thud = GameBase.gi.soundindex("mutant/thud1.wav"); self.movetype = Defines.MOVETYPE_STEP; self.solid = Defines.SOLID_BBOX; self.s.modelindex = GameBase.gi .modelindex("models/monsters/mutant/tris.md2"); Math3D.VectorSet(self.mins, -32, -32, -24); Math3D.VectorSet(self.maxs, 32, 32, 48); self.health = 300; self.gib_health = -120; self.mass = 300; self.pain = mutant_pain; self.die = mutant_die; self.monsterinfo.stand = mutant_stand; self.monsterinfo.walk = mutant_walk; self.monsterinfo.run = mutant_run; self.monsterinfo.dodge = null; self.monsterinfo.attack = mutant_jump; self.monsterinfo.melee = mutant_melee; self.monsterinfo.sight = mutant_sight; self.monsterinfo.search = mutant_search; self.monsterinfo.idle = mutant_idle; self.monsterinfo.checkattack = mutant_checkattack; GameBase.gi.linkentity(self); self.monsterinfo.currentmove = mutant_move_stand; self.monsterinfo.scale = MODEL_SCALE; GameAI.walkmonster_start.think(self); return true; } };}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -