📄 m_tank.java
字号:
if (GameBase.skill.value >= 2) if (self.enemy.health > 0) if (GameUtil.visible(self, self.enemy)) if (Lib.random() <= 0.4) { self.monsterinfo.currentmove = tank_move_attack_fire_rocket; return true; } self.monsterinfo.currentmove = tank_move_attack_post_rocket; return true; } }; static mframe_t tank_frames_attack_strike[] = new mframe_t[] { new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 1, null), new mframe_t(GameAI.ai_move, 6, null), new mframe_t(GameAI.ai_move, 7, null), new mframe_t(GameAI.ai_move, 9, tank_footstep), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 1, null), new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 2, tank_footstep), 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, -2, null), new mframe_t(GameAI.ai_move, -2, null), new mframe_t(GameAI.ai_move, 0, tank_windup), 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, TankStrike), new mframe_t(GameAI.ai_move, 0, null), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -3, null), new mframe_t(GameAI.ai_move, -10, null), new mframe_t(GameAI.ai_move, -10, null), new mframe_t(GameAI.ai_move, -2, null), new mframe_t(GameAI.ai_move, -3, null), new mframe_t(GameAI.ai_move, -2, tank_footstep) }; static mmove_t tank_move_attack_strike = new mmove_t(FRAME_attak201, FRAME_attak238, tank_frames_attack_strike, tank_poststrike); static mframe_t tank_frames_attack_pre_rocket[] = 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, 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, 0, null), new mframe_t(GameAI.ai_charge, 0, null), // 10) 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, 7, null), new mframe_t(GameAI.ai_charge, 7, null), new mframe_t(GameAI.ai_charge, 7, tank_footstep), 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), // 20) new mframe_t(GameAI.ai_charge, -3, null) }; static mmove_t tank_move_attack_pre_rocket = new mmove_t(FRAME_attak301, FRAME_attak321, tank_frames_attack_pre_rocket, tank_doattack_rocket); static mframe_t tank_frames_attack_fire_rocket[] = new mframe_t[] { new mframe_t(GameAI.ai_charge, -3, null), // Loop Start 22 ) new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, TankRocket), // 24) new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, TankRocket), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, -1, TankRocket) // 30 Loop End }; static mmove_t tank_move_attack_fire_rocket = new mmove_t(FRAME_attak322, FRAME_attak330, tank_frames_attack_fire_rocket, tank_refire_rocket); static mframe_t tank_frames_attack_post_rocket[] = new mframe_t[] { new mframe_t(GameAI.ai_charge, 0, null), // 31) 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, 2, null), new mframe_t(GameAI.ai_charge, 3, null), new mframe_t(GameAI.ai_charge, 4, null), new mframe_t(GameAI.ai_charge, 2, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), // 40) new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, -9, null), new mframe_t(GameAI.ai_charge, -8, null), new mframe_t(GameAI.ai_charge, -7, null), new mframe_t(GameAI.ai_charge, -1, null), new mframe_t(GameAI.ai_charge, -1, tank_footstep), 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), // 50) new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null) }; static mmove_t tank_move_attack_post_rocket = new mmove_t(FRAME_attak331, FRAME_attak353, tank_frames_attack_post_rocket, tank_run); static mframe_t tank_frames_attack_chain[] = 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, 0, null), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), new mframe_t(null, 0, TankMachineGun), 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, 0, null) }; static mmove_t tank_move_attack_chain = new mmove_t(FRAME_attak401, FRAME_attak429, tank_frames_attack_chain, tank_run); static EntThinkAdapter tank_attack = new EntThinkAdapter() { public String getID(){ return "tank_attack"; } public boolean think(edict_t self) { float[] vec = { 0, 0, 0 }; float range; float r; if (self.enemy.health < 0) { self.monsterinfo.currentmove = tank_move_attack_strike; self.monsterinfo.aiflags &= ~Defines.AI_BRUTAL; return true; } Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, vec); range = Math3D.VectorLength(vec); r = Lib.random(); if (range <= 125) { if (r < 0.4) self.monsterinfo.currentmove = tank_move_attack_chain; else self.monsterinfo.currentmove = tank_move_attack_blast; } else if (range <= 250) { if (r < 0.5) self.monsterinfo.currentmove = tank_move_attack_chain; else self.monsterinfo.currentmove = tank_move_attack_blast; } else { if (r < 0.33) self.monsterinfo.currentmove = tank_move_attack_chain; else if (r < 0.66) { self.monsterinfo.currentmove = tank_move_attack_pre_rocket; self.pain_debounce_time = GameBase.level.time + 5.0f; // no // pain // for // a // while } else self.monsterinfo.currentmove = tank_move_attack_blast; } return true; } }; // // death // static EntThinkAdapter tank_dead = new EntThinkAdapter() { public String getID(){ return "tank_dead"; } public boolean think(edict_t self) { Math3D.VectorSet(self.mins, -16, -16, -16); Math3D.VectorSet(self.maxs, 16, 16, -0); self.movetype = Defines.MOVETYPE_TOSS; self.svflags |= Defines.SVF_DEADMONSTER; self.nextthink = 0; GameBase.gi.linkentity(self); return true; } }; static mframe_t tank_frames_death1[] = new mframe_t[] { new mframe_t(GameAI.ai_move, -7, null), new mframe_t(GameAI.ai_move, -2, null), new mframe_t(GameAI.ai_move, -2, null), new mframe_t(GameAI.ai_move, 1, null), new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 6, null), new mframe_t(GameAI.ai_move, 1, null), new mframe_t(GameAI.ai_move, 1, 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, -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, 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, -4, null), new mframe_t(GameAI.ai_move, -6, null), new mframe_t(GameAI.ai_move, -4, null), new mframe_t(GameAI.ai_move, -5, null), new mframe_t(GameAI.ai_move, -7, null), new mframe_t(GameAI.ai_move, -15, tank_thud), new mframe_t(GameAI.ai_move, -5, 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_death = new mmove_t(FRAME_death101, FRAME_death132, tank_frames_death1, tank_dead); static EntDieAdapter tank_die = new EntDieAdapter() { public String getID(){ return "tank_die"; } public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) { int n; // check for gib 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 < 1 /* 4 */; n++) GameMisc.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC); for (n = 0; n < 4; n++) GameMisc.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, Defines.GIB_METALLIC); GameMisc.ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, Defines.GIB_ORGANIC); GameMisc.ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, Defines.GIB_METALLIC); self.deadflag = Defines.DEAD_DEAD; return; } if (self.deadflag == Defines.DEAD_DEAD) return; // regular death GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die, 1, Defines.ATTN_NORM, 0); self.deadflag = Defines.DEAD_DEAD; self.takedamage = Defines.DAMAGE_YES; self.monsterinfo.currentmove = tank_move_death; } }; // // monster_tank // /* * QUAKED monster_tank (1 .5 0) (-32 -32 -16) (32 32 72) Ambush * Trigger_Spawn Sight */ /* * QUAKED monster_tank_commander (1 .5 0) (-32 -32 -16) (32 32 72) Ambush * Trigger_Spawn Sight */ public static EntThinkAdapter SP_monster_tank = new EntThinkAdapter() { public String getID(){ return "SP_monster_tank"; } public boolean think(edict_t self) { if (GameBase.deathmatch.value != 0) { GameUtil.G_FreeEdict(self); return true; } self.s.modelindex = GameBase.gi .modelindex("models/monsters/tank/tris.md2"); Math3D.VectorSet(self.mins, -32, -32, -16); Math3D.VectorSet(self.maxs, 32, 32, 72); self.movetype = Defines.MOVETYPE_STEP; self.solid = Defines.SOLID_BBOX; sound_pain = GameBase.gi.soundindex("tank/tnkpain2.wav"); sound_thud = GameBase.gi.soundindex("tank/tnkdeth2.wav"); sound_idle = GameBase.gi.soundindex("tank/tnkidle1.wav"); sound_die = GameBase.gi.soundindex("tank/death.wav"); sound_step = GameBase.gi.soundindex("tank/step.wav"); sound_windup = GameBase.gi.soundindex("tank/tnkatck4.wav"); sound_strike = GameBase.gi.soundindex("tank/tnkatck5.wav"); sound_sight = GameBase.gi.soundindex("tank/sight1.wav"); GameBase.gi.soundindex("tank/tnkatck1.wav"); GameBase.gi.soundindex("tank/tnkatk2a.wav"); GameBase.gi.soundindex("tank/tnkatk2b.wav"); GameBase.gi.soundindex("tank/tnkatk2c.wav"); GameBase.gi.soundindex("tank/tnkatk2d.wav"); GameBase.gi.soundindex("tank/tnkatk2e.wav"); GameBase.gi.soundindex("tank/tnkatck3.wav"); if (Lib.strcmp(self.classname, "monster_tank_commander") == 0) { self.health = 1000; self.gib_health = -225; } else { self.health = 750; self.gib_health = -200; } self.mass = 500; self.pain = tank_pain; self.die = tank_die; self.monsterinfo.stand = tank_stand; self.monsterinfo.walk = tank_walk; self.monsterinfo.run = tank_run; self.monsterinfo.dodge = null; self.monsterinfo.attack = tank_attack; self.monsterinfo.melee = null; self.monsterinfo.sight = tank_sight; self.monsterinfo.idle = tank_idle; GameBase.gi.linkentity(self); self.monsterinfo.currentmove = tank_move_stand; self.monsterinfo.scale = MODEL_SCALE; GameAI.walkmonster_start.think(self); if (Lib.strcmp(self.classname, "monster_tank_commander") == 0) self.s.skinnum = 2; return true; } };}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -