📄 m_tank.java
字号:
static EntThinkAdapter tank_walk = new EntThinkAdapter() { public String getID(){ return "tank_walk"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = tank_move_walk; return true; } }; static mframe_t tank_frames_start_walk[] = new mframe_t[] { new mframe_t(GameAI.ai_walk, 0, null), new mframe_t(GameAI.ai_walk, 6, null), new mframe_t(GameAI.ai_walk, 6, null), new mframe_t(GameAI.ai_walk, 11, tank_footstep) }; static mmove_t tank_move_start_walk = new mmove_t(FRAME_walk01, FRAME_walk04, tank_frames_start_walk, tank_walk); static mframe_t tank_frames_walk[] = new mframe_t[] { new mframe_t(GameAI.ai_walk, 4, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 3, null), new mframe_t(GameAI.ai_walk, 2, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 4, null), new mframe_t(GameAI.ai_walk, 4, tank_footstep), new mframe_t(GameAI.ai_walk, 3, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 4, null), new mframe_t(GameAI.ai_walk, 5, null), new mframe_t(GameAI.ai_walk, 7, null), new mframe_t(GameAI.ai_walk, 7, null), new mframe_t(GameAI.ai_walk, 6, null), new mframe_t(GameAI.ai_walk, 6, tank_footstep) }; static mmove_t tank_move_walk = new mmove_t(FRAME_walk05, FRAME_walk20, tank_frames_walk, null); static mframe_t tank_frames_stop_walk[] = new mframe_t[] { new mframe_t(GameAI.ai_walk, 3, null), new mframe_t(GameAI.ai_walk, 3, null), new mframe_t(GameAI.ai_walk, 2, null), new mframe_t(GameAI.ai_walk, 2, null), new mframe_t(GameAI.ai_walk, 4, tank_footstep) }; static mmove_t tank_move_stop_walk = new mmove_t(FRAME_walk21, FRAME_walk25, tank_frames_stop_walk, tank_stand); // // run // static mframe_t tank_frames_start_run[] = new mframe_t[] { new mframe_t(GameAI.ai_run, 0, null), new mframe_t(GameAI.ai_run, 6, null), new mframe_t(GameAI.ai_run, 6, null), new mframe_t(GameAI.ai_run, 11, tank_footstep) }; static mmove_t tank_move_start_run = new mmove_t(FRAME_walk01, FRAME_walk04, tank_frames_start_run, tank_run); static mframe_t tank_frames_run[] = new mframe_t[] { new mframe_t(GameAI.ai_run, 4, null), new mframe_t(GameAI.ai_run, 5, null), new mframe_t(GameAI.ai_run, 3, null), new mframe_t(GameAI.ai_run, 2, null), new mframe_t(GameAI.ai_run, 5, null), new mframe_t(GameAI.ai_run, 5, null), new mframe_t(GameAI.ai_run, 4, null), new mframe_t(GameAI.ai_run, 4, tank_footstep), new mframe_t(GameAI.ai_run, 3, null), new mframe_t(GameAI.ai_run, 5, null), new mframe_t(GameAI.ai_run, 4, null), new mframe_t(GameAI.ai_run, 5, null), new mframe_t(GameAI.ai_run, 7, null), new mframe_t(GameAI.ai_run, 7, null), new mframe_t(GameAI.ai_run, 6, null), new mframe_t(GameAI.ai_run, 6, tank_footstep) }; static mmove_t tank_move_run = new mmove_t(FRAME_walk05, FRAME_walk20, tank_frames_run, null); static mframe_t tank_frames_stop_run[] = new mframe_t[] { new mframe_t(GameAI.ai_run, 3, null), new mframe_t(GameAI.ai_run, 3, null), new mframe_t(GameAI.ai_run, 2, null), new mframe_t(GameAI.ai_run, 2, null), new mframe_t(GameAI.ai_run, 4, tank_footstep) }; static mmove_t tank_move_stop_run = new mmove_t(FRAME_walk21, FRAME_walk25, tank_frames_stop_run, tank_walk); // // pain // static mframe_t tank_frames_pain1[] = 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) }; static mmove_t tank_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain104, tank_frames_pain1, tank_run); static mframe_t tank_frames_pain2[] = 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) }; static mmove_t tank_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain205, tank_frames_pain2, tank_run); static mframe_t tank_frames_pain3[] = new mframe_t[] { new mframe_t(GameAI.ai_move, -7, 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, 2, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 2, 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, tank_footstep) }; static mmove_t tank_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain316, tank_frames_pain3, tank_run); static EntPainAdapter tank_pain = new EntPainAdapter() { public String getID(){ return "tank_pain"; } public void pain(edict_t self, edict_t other, float kick, int damage) { if (self.health < (self.max_health / 2)) self.s.skinnum |= 1; if (damage <= 10) return; if (GameBase.level.time < self.pain_debounce_time) return; if (damage <= 30) if (Lib.random() > 0.2) return; // If hard or nightmare, don't go into pain while attacking if (GameBase.skill.value >= 2) { if ((self.s.frame >= FRAME_attak301) && (self.s.frame <= FRAME_attak330)) return; if ((self.s.frame >= FRAME_attak101) && (self.s.frame <= FRAME_attak116)) return; } self.pain_debounce_time = GameBase.level.time + 3; GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain, 1, Defines.ATTN_NORM, 0); if (GameBase.skill.value == 3) return; // no pain anims in nightmare if (damage <= 30) self.monsterinfo.currentmove = tank_move_pain1; else if (damage <= 60) self.monsterinfo.currentmove = tank_move_pain2; else self.monsterinfo.currentmove = tank_move_pain3; } }; // // attacks // static EntThinkAdapter TankBlaster = new EntThinkAdapter() { public String getID(){ return "TankBlaster"; } public boolean think(edict_t self) { float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; float[] start = { 0, 0, 0 }; float[] end = { 0, 0, 0 }; float[] dir = { 0, 0, 0 }; int flash_number; if (self.s.frame == FRAME_attak110) flash_number = Defines.MZ2_TANK_BLASTER_1; else if (self.s.frame == FRAME_attak113) flash_number = Defines.MZ2_TANK_BLASTER_2; else // (self.s.frame == FRAME_attak116) flash_number = Defines.MZ2_TANK_BLASTER_3; Math3D.AngleVectors(self.s.angles, forward, right, null); Math3D.G_ProjectSource(self.s.origin, M_Flash.monster_flash_offset[flash_number], forward, right, start); Math3D.VectorCopy(self.enemy.s.origin, end); end[2] += self.enemy.viewheight; Math3D.VectorSubtract(end, start, dir); Monster.monster_fire_blaster(self, start, dir, 30, 800, flash_number, Defines.EF_BLASTER); return true; } }; static EntThinkAdapter TankStrike = new EntThinkAdapter() { public String getID(){ return "TankStrike"; } public boolean think(edict_t self) { GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_strike, 1, Defines.ATTN_NORM, 0); return true; } }; static EntThinkAdapter TankRocket = new EntThinkAdapter() { public String getID(){ return "TankRocket"; } public boolean think(edict_t self) { float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; float[] start = { 0, 0, 0 }; float[] dir = { 0, 0, 0 }; float[] vec = { 0, 0, 0 }; int flash_number; if (self.s.frame == FRAME_attak324) flash_number = Defines.MZ2_TANK_ROCKET_1; else if (self.s.frame == FRAME_attak327) flash_number = Defines.MZ2_TANK_ROCKET_2; else // (self.s.frame == FRAME_attak330) flash_number = Defines.MZ2_TANK_ROCKET_3; Math3D.AngleVectors(self.s.angles, forward, right, null); Math3D.G_ProjectSource(self.s.origin, M_Flash.monster_flash_offset[flash_number], forward, right, start); Math3D.VectorCopy(self.enemy.s.origin, vec); vec[2] += self.enemy.viewheight; Math3D.VectorSubtract(vec, start, dir); Math3D.VectorNormalize(dir); Monster .monster_fire_rocket(self, start, dir, 50, 550, flash_number); return true; } }; static EntThinkAdapter TankMachineGun = new EntThinkAdapter() { public String getID(){ return "TankMachineGun"; } public boolean think(edict_t self) { float[] dir = { 0, 0, 0 }; float[] vec = { 0, 0, 0 }; float[] start = { 0, 0, 0 }; float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; int flash_number; flash_number = Defines.MZ2_TANK_MACHINEGUN_1 + (self.s.frame - FRAME_attak406); Math3D.AngleVectors(self.s.angles, forward, right, null); Math3D.G_ProjectSource(self.s.origin, M_Flash.monster_flash_offset[flash_number], forward, right, start); if (self.enemy != null) { Math3D.VectorCopy(self.enemy.s.origin, vec); vec[2] += self.enemy.viewheight; Math3D.VectorSubtract(vec, start, vec); Math3D.vectoangles(vec, vec); dir[0] = vec[0]; } else { dir[0] = 0; } if (self.s.frame <= FRAME_attak415) dir[1] = self.s.angles[1] - 8 * (self.s.frame - FRAME_attak411); else dir[1] = self.s.angles[1] + 8 * (self.s.frame - FRAME_attak419); dir[2] = 0; Math3D.AngleVectors(dir, forward, null, null); Monster.monster_fire_bullet(self, start, forward, 20, 4, Defines.DEFAULT_BULLET_HSPREAD, Defines.DEFAULT_BULLET_VSPREAD, flash_number); return true; } }; static EntThinkAdapter tank_reattack_blaster = new EntThinkAdapter() { public String getID(){ return "tank_reattack_blaster"; } public boolean think(edict_t self) { if (GameBase.skill.value >= 2) if (GameUtil.visible(self, self.enemy)) if (self.enemy.health > 0) if (Lib.random() <= 0.6) { self.monsterinfo.currentmove = tank_move_reattack_blast; return true; } self.monsterinfo.currentmove = tank_move_attack_post_blast; return true; } }; static mframe_t tank_frames_attack_blast[] = 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, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, -1, null), new mframe_t(GameAI.ai_charge, -2, null), new mframe_t(GameAI.ai_charge, -1, null), new mframe_t(GameAI.ai_charge, -1, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, TankBlaster), // 10 new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, TankBlaster), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, TankBlaster) // 16 }; static mmove_t tank_move_attack_blast = new mmove_t(FRAME_attak101, FRAME_attak116, tank_frames_attack_blast, tank_reattack_blaster); static mframe_t tank_frames_reattack_blast[] = 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, TankBlaster), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, TankBlaster) // 16) }; static mmove_t tank_move_reattack_blast = new mmove_t(FRAME_attak111, FRAME_attak116, tank_frames_reattack_blast, tank_reattack_blaster); static mframe_t tank_frames_attack_post_blast[] = new mframe_t[] { new mframe_t(GameAI.ai_move, 0, null), // 17) new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, -2, tank_footstep) // 22 }; static mmove_t tank_move_attack_post_blast = new mmove_t(FRAME_attak117, FRAME_attak122, tank_frames_attack_post_blast, tank_run); static EntThinkAdapter tank_poststrike = new EntThinkAdapter() { public String getID(){ return "tank_poststrike"; } public boolean think(edict_t self) { self.enemy = null; tank_run.think(self); return true; } }; static EntThinkAdapter tank_doattack_rocket = new EntThinkAdapter() { public String getID(){ return "tank_doattack_rocket"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = tank_move_attack_fire_rocket; return true; } }; static EntThinkAdapter tank_refire_rocket = new EntThinkAdapter() { public String getID(){ return "tank_refire_rocket"; } public boolean think(edict_t self) { // Only on hard or nightmare
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -