📄 m_medic.java
字号:
self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; return true; } }; static EntThinkAdapter medic_duck_up = new EntThinkAdapter() { public String getID(){ return "medic_duck_up"; } public boolean think(edict_t self) { self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; self.maxs[2] += 32; self.takedamage = Defines.DAMAGE_AIM; GameBase.gi.linkentity(self); return true; } }; static mframe_t medic_frames_duck[] = new mframe_t[] { new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, medic_duck_down), new mframe_t(GameAI.ai_move, -1, medic_duck_hold), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, null), new mframe_t(GameAI.ai_move, -1, medic_duck_up), 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, -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) }; static mmove_t medic_move_duck = new mmove_t(FRAME_duck1, FRAME_duck16, medic_frames_duck, medic_run); static EntDodgeAdapter medic_dodge = new EntDodgeAdapter() { public String getID(){ return "medic_dodge"; } public void dodge(edict_t self, edict_t attacker, float eta) { if (Lib.random() > 0.25) return; if (self.enemy == null) self.enemy = attacker; self.monsterinfo.currentmove = medic_move_duck; } }; static mframe_t medic_frames_attackHyperBlaster[] = 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, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster) }; static mmove_t medic_move_attackHyperBlaster = new mmove_t(FRAME_attack15, FRAME_attack30, medic_frames_attackHyperBlaster, medic_run); static EntThinkAdapter medic_continue = new EntThinkAdapter() { public String getID(){ return "medic_continue"; } public boolean think(edict_t self) { if (GameUtil.visible(self, self.enemy)) if (Lib.random() <= 0.95) self.monsterinfo.currentmove = medic_move_attackHyperBlaster; return true; } }; static mframe_t medic_frames_attackBlaster[] = { new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 5, null), new mframe_t(GameAI.ai_charge, 5, null), new mframe_t(GameAI.ai_charge, 3, 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), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_charge, 0, medic_continue) // Change to // medic_continue... // Else, go to // frame 32 }; static mmove_t medic_move_attackBlaster = new mmove_t(FRAME_attack1, FRAME_attack14, medic_frames_attackBlaster, medic_run); static EntThinkAdapter medic_hook_launch = new EntThinkAdapter() { public String getID(){ return "medic_hook_launch"; } public boolean think(edict_t self) { GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hook_launch, 1, Defines.ATTN_NORM, 0); return true; } }; static float medic_cable_offsets[][] = { { 45.0f, -9.2f, 15.5f }, { 48.4f, -9.7f, 15.2f }, { 47.8f, -9.8f, 15.8f }, { 47.3f, -9.3f, 14.3f }, { 45.4f, -10.1f, 13.1f }, { 41.9f, -12.7f, 12.0f }, { 37.8f, -15.8f, 11.2f }, { 34.3f, -18.4f, 10.7f }, { 32.7f, -19.7f, 10.4f }, { 32.7f, -19.7f, 10.4f } }; static EntThinkAdapter medic_cable_attack = new EntThinkAdapter() { public String getID(){ return "medic_cable_attack"; } public boolean think(edict_t self) { float[] offset = { 0, 0, 0 }, start = { 0, 0, 0 }, end = { 0, 0, 0 }, f = { 0, 0, 0 }, r = { 0, 0, 0 }; trace_t tr; float[] dir = { 0, 0, 0 }, angles = { 0, 0, 0 }; float distance; if (!self.enemy.inuse) return true; Math3D.AngleVectors(self.s.angles, f, r, null); Math3D.VectorCopy( medic_cable_offsets[self.s.frame - FRAME_attack42], offset); Math3D.G_ProjectSource(self.s.origin, offset, f, r, start); // check for max distance Math3D.VectorSubtract(start, self.enemy.s.origin, dir); distance = Math3D.VectorLength(dir); if (distance > 256) return true; // check for min/max pitch Math3D.vectoangles(dir, angles); if (angles[0] < -180) angles[0] += 360; if (Math.abs(angles[0]) > 45) return true; tr = GameBase.gi.trace(start, null, null, self.enemy.s.origin, self, Defines.MASK_SHOT); if (tr.fraction != 1.0 && tr.ent != self.enemy) return true; if (self.s.frame == FRAME_attack43) { GameBase.gi.sound(self.enemy, Defines.CHAN_AUTO, sound_hook_hit, 1, Defines.ATTN_NORM, 0); self.enemy.monsterinfo.aiflags |= Defines.AI_RESURRECTING; } else if (self.s.frame == FRAME_attack50) { self.enemy.spawnflags = 0; self.enemy.monsterinfo.aiflags = 0; self.enemy.target = null; self.enemy.targetname = null; self.enemy.combattarget = null; self.enemy.deathtarget = null; self.enemy.owner = self; GameSpawn.ED_CallSpawn(self.enemy); self.enemy.owner = null; if (self.enemy.think != null) { self.enemy.nextthink = GameBase.level.time; self.enemy.think.think(self.enemy); } self.enemy.monsterinfo.aiflags |= Defines.AI_RESURRECTING; if (self.oldenemy != null && self.oldenemy.client != null) { self.enemy.enemy = self.oldenemy; GameUtil.FoundTarget(self.enemy); } } else { if (self.s.frame == FRAME_attack44) GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hook_heal, 1, Defines.ATTN_NORM, 0); } // adjust start for beam origin being in middle of a segment Math3D.VectorMA(start, 8, f, start); // adjust end z for end spot since the monster is currently dead Math3D.VectorCopy(self.enemy.s.origin, end); end[2] = self.enemy.absmin[2] + self.enemy.size[2] / 2; GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(Defines.TE_MEDIC_CABLE_ATTACK); GameBase.gi.WriteShort(self.index); GameBase.gi.WritePosition(start); GameBase.gi.WritePosition(end); GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); return true; } }; static EntThinkAdapter medic_hook_retract = new EntThinkAdapter() { public String getID(){ return "medic_hook_retract"; } public boolean think(edict_t self) { GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hook_retract, 1, Defines.ATTN_NORM, 0); self.enemy.monsterinfo.aiflags &= ~Defines.AI_RESURRECTING; return true; } }; static mframe_t medic_frames_attackCable[] = new mframe_t[] { new mframe_t(GameAI.ai_move, 2, null), new mframe_t(GameAI.ai_move, 3, null), new mframe_t(GameAI.ai_move, 5, null), new mframe_t(GameAI.ai_move, 4.4f, null), new mframe_t(GameAI.ai_charge, 4.7f, null), new mframe_t(GameAI.ai_charge, 5, null), new mframe_t(GameAI.ai_charge, 6, null), new mframe_t(GameAI.ai_charge, 4, null), new mframe_t(GameAI.ai_charge, 0, null), new mframe_t(GameAI.ai_move, 0, medic_hook_launch), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, 0, medic_cable_attack), new mframe_t(GameAI.ai_move, -15, medic_hook_retract), new mframe_t(GameAI.ai_move, -1.5f, null), new mframe_t(GameAI.ai_move, -1.2f, null), new mframe_t(GameAI.ai_move, -3, null), new mframe_t(GameAI.ai_move, -2, null), new mframe_t(GameAI.ai_move, 0.3f, null), new mframe_t(GameAI.ai_move, 0.7f, null), new mframe_t(GameAI.ai_move, 1.2f, null), new mframe_t(GameAI.ai_move, 1.3f, null) }; static mmove_t medic_move_attackCable = new mmove_t(FRAME_attack33, FRAME_attack60, medic_frames_attackCable, medic_run); static EntThinkAdapter medic_attack = new EntThinkAdapter() { public String getID(){ return "medic_attack"; } public boolean think(edict_t self) { if ((self.monsterinfo.aiflags & Defines.AI_MEDIC) != 0) self.monsterinfo.currentmove = medic_move_attackCable; else self.monsterinfo.currentmove = medic_move_attackBlaster; return true; } }; static EntThinkAdapter medic_checkattack = new EntThinkAdapter() { public String getID(){ return "medic_checkattack"; } public boolean think(edict_t self) { if ((self.monsterinfo.aiflags & Defines.AI_MEDIC) != 0) { medic_attack.think(self); return true; } return GameUtil.M_CheckAttack.think(self); } }; /* * QUAKED monster_medic (1 .5 0) (-16 -16 -24) (16 16 32) Ambush * Trigger_Spawn Sight */ public static void SP_monster_medic(edict_t self) { if (GameBase.deathmatch.value != 0) { GameUtil.G_FreeEdict(self); return; } sound_idle1 = GameBase.gi.soundindex("medic/idle.wav"); sound_pain1 = GameBase.gi.soundindex("medic/medpain1.wav"); sound_pain2 = GameBase.gi.soundindex("medic/medpain2.wav"); sound_die = GameBase.gi.soundindex("medic/meddeth1.wav"); sound_sight = GameBase.gi.soundindex("medic/medsght1.wav"); sound_search = GameBase.gi.soundindex("medic/medsrch1.wav"); sound_hook_launch = GameBase.gi.soundindex("medic/medatck2.wav"); sound_hook_hit = GameBase.gi.soundindex("medic/medatck3.wav"); sound_hook_heal = GameBase.gi.soundindex("medic/medatck4.wav"); sound_hook_retract = GameBase.gi.soundindex("medic/medatck5.wav"); GameBase.gi.soundindex("medic/medatck1.wav"); self.movetype = Defines.MOVETYPE_STEP; self.solid = Defines.SOLID_BBOX; self.s.modelindex = GameBase.gi .modelindex("models/monsters/medic/tris.md2"); Math3D.VectorSet(self.mins, -24, -24, -24); Math3D.VectorSet(self.maxs, 24, 24, 32); self.health = 300; self.gib_health = -130; self.mass = 400; self.pain = medic_pain; self.die = medic_die; self.monsterinfo.stand = medic_stand; self.monsterinfo.walk = medic_walk; self.monsterinfo.run = medic_run; self.monsterinfo.dodge = medic_dodge; self.monsterinfo.attack = medic_attack; self.monsterinfo.melee = null; self.monsterinfo.sight = medic_sight; self.monsterinfo.idle = medic_idle; self.monsterinfo.search = medic_search; self.monsterinfo.checkattack = medic_checkattack; GameBase.gi.linkentity(self); self.monsterinfo.currentmove = medic_move_stand; self.monsterinfo.scale = MODEL_SCALE; GameAI.walkmonster_start.think(self); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -