⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_berserk.java

📁 JAKE2用JAVA写的queck2的3D游戏开发引擎
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            new mframe_t(GameAI.ai_run, 21, null),            new mframe_t(GameAI.ai_run, 25, null),            new mframe_t(GameAI.ai_run, 18, null),            new mframe_t(GameAI.ai_run, 19, null) };    static mmove_t berserk_move_run1 = new mmove_t(FRAME_run1, FRAME_run6,            berserk_frames_run1, null);    static EntThinkAdapter berserk_run = new EntThinkAdapter() {        public String getID() { return "berserk_run";}        public boolean think(edict_t self) {            if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0)                self.monsterinfo.currentmove = berserk_move_stand;            else                self.monsterinfo.currentmove = berserk_move_run1;            return true;        }    };    static EntThinkAdapter berserk_attack_spike = new EntThinkAdapter() {        public String getID() { return "berserk_attack_spike";}        public boolean think(edict_t self) {            float[] aim = { Defines.MELEE_DISTANCE, 0f, -24f };            GameWeapon.fire_hit(self, aim, (15 + (Lib.rand() % 6)), 400);            //	Faster attack -- upwards and backwards            return true;        }    };    static EntThinkAdapter berserk_swing = new EntThinkAdapter() {        public String getID() { return "berserk_swing";}        public boolean think(edict_t self) {            GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_punch, 1,                    Defines.ATTN_NORM, 0);            return true;        }    };    static mframe_t berserk_frames_attack_spike[] = 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, berserk_swing),            new mframe_t(GameAI.ai_charge, 0, berserk_attack_spike),            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 berserk_move_attack_spike = new mmove_t(FRAME_att_c1,            FRAME_att_c8, berserk_frames_attack_spike, berserk_run);    static EntThinkAdapter berserk_attack_club = new EntThinkAdapter() {        public String getID() { return "berserk_attack_club";}        public boolean think(edict_t self) {            float aim[] = { 0, 0, 0 };            Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], -4);            GameWeapon.fire_hit(self, aim, (5 + (Lib.rand() % 6)), 400); // Slower                                                                   // attack            return true;        }    };    static mframe_t berserk_frames_attack_club[] = 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, berserk_swing),            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, berserk_attack_club),            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 berserk_move_attack_club = new mmove_t(FRAME_att_c9,            FRAME_att_c20, berserk_frames_attack_club, berserk_run);    static EntThinkAdapter berserk_strike = new EntThinkAdapter() {        public String getID() { return "berserk_strike";}        public boolean think(edict_t self) {            return true;        }    };    static mframe_t berserk_frames_attack_strike[] = 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, berserk_swing),            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, berserk_strike),            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, 9.7f, null),            new mframe_t(GameAI.ai_move, 13.6f, null) };    static mmove_t berserk_move_attack_strike = new mmove_t(FRAME_att_c21,            FRAME_att_c34, berserk_frames_attack_strike, berserk_run);    static EntThinkAdapter berserk_melee = new EntThinkAdapter() {        public String getID() { return "berserk_melee";}        public boolean think(edict_t self) {            if ((Lib.rand() % 2) == 0)                self.monsterinfo.currentmove = berserk_move_attack_spike;            else                self.monsterinfo.currentmove = berserk_move_attack_club;            return true;        }    };    /*     * void() berserk_atke1 =[ $r_attb1, berserk_atke2 ] {ai_run(9);}; void()     * berserk_atke2 =[ $r_attb2, berserk_atke3 ] {ai_run(6);}; void()     * berserk_atke3 =[ $r_attb3, berserk_atke4 ] {ai_run(18.4);}; void()     * berserk_atke4 =[ $r_attb4, berserk_atke5 ] {ai_run(25);}; void()     * berserk_atke5 =[ $r_attb5, berserk_atke6 ] {ai_run(14);}; void()     * berserk_atke6 =[ $r_attb6, berserk_atke7 ] {ai_run(20);}; void()     * berserk_atke7 =[ $r_attb7, berserk_atke8 ] {ai_run(8.5);}; void()     * berserk_atke8 =[ $r_attb8, berserk_atke9 ] {ai_run(3);}; void()     * berserk_atke9 =[ $r_attb9, berserk_atke10 ] {ai_run(17.5);}; void()     * berserk_atke10 =[ $r_attb10, berserk_atke11 ] {ai_run(17);}; void()     * berserk_atke11 =[ $r_attb11, berserk_atke12 ] {ai_run(9);}; void()     * berserk_atke12 =[ $r_attb12, berserk_atke13 ] {ai_run(25);}; void()     * berserk_atke13 =[ $r_attb13, berserk_atke14 ] {ai_run(3.7);}; void()     * berserk_atke14 =[ $r_attb14, berserk_atke15 ] {ai_run(2.6);}; void()     * berserk_atke15 =[ $r_attb15, berserk_atke16 ] {ai_run(19);}; void()     * berserk_atke16 =[ $r_attb16, berserk_atke17 ] {ai_run(25);}; void()     * berserk_atke17 =[ $r_attb17, berserk_atke18 ] {ai_run(19.6);}; void()     * berserk_atke18 =[ $r_attb18, berserk_run1 ] {ai_run(7.8);};     */    static mframe_t berserk_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 berserk_move_pain1 = new mmove_t(FRAME_painc1, FRAME_painc4,            berserk_frames_pain1, berserk_run);    static mframe_t berserk_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),            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),            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 berserk_move_pain2 = new mmove_t(FRAME_painb1,            FRAME_painb20, berserk_frames_pain2, berserk_run);    static EntPainAdapter berserk_pain = new EntPainAdapter() {        public String getID() { return "berserk_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 (GameBase.level.time < self.pain_debounce_time)                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 < 20) || (Lib.random() < 0.5))                self.monsterinfo.currentmove = berserk_move_pain1;            else                self.monsterinfo.currentmove = berserk_move_pain2;        }    };    static EntThinkAdapter berserk_dead = new EntThinkAdapter() {        public String getID() { return "berserk_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;            self.nextthink = 0;            GameBase.gi.linkentity(self);            return true;        }    };    static mframe_t berserk_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),            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 berserk_move_death1 = new mmove_t(FRAME_death1,            FRAME_death13, berserk_frames_death1, berserk_dead);    static mframe_t berserk_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) };    static mmove_t berserk_move_death2 = new mmove_t(FRAME_deathc1,            FRAME_deathc8, berserk_frames_death2, berserk_dead);    static EntDieAdapter berserk_die = new EntDieAdapter() {        public String getID() { return "berserk_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_die, 1,                    Defines.ATTN_NORM, 0);            self.deadflag = Defines.DEAD_DEAD;            self.takedamage = Defines.DAMAGE_YES;            if (damage >= 50)                self.monsterinfo.currentmove = berserk_move_death1;            else                self.monsterinfo.currentmove = berserk_move_death2;        }    };    /*     * QUAKED monster_berserk (1 .5 0) (-16 -16 -24) (16 16 32) Ambush     * Trigger_Spawn Sight     */    public static void SP_monster_berserk(edict_t self) {        if (GameBase.deathmatch.value != 0) {            GameUtil.G_FreeEdict(self);            return;        }        // pre-caches        sound_pain = GameBase.gi.soundindex("berserk/berpain2.wav");        sound_die = GameBase.gi.soundindex("berserk/berdeth2.wav");        sound_idle = GameBase.gi.soundindex("berserk/beridle1.wav");        sound_punch = GameBase.gi.soundindex("berserk/attack.wav");        sound_search = GameBase.gi.soundindex("berserk/bersrch1.wav");        sound_sight = GameBase.gi.soundindex("berserk/sight.wav");        self.s.modelindex = GameBase.gi                .modelindex("models/monsters/berserk/tris.md2");        Math3D.VectorSet(self.mins, -16, -16, -24);        Math3D.VectorSet(self.maxs, 16, 16, 32);        self.movetype = Defines.MOVETYPE_STEP;        self.solid = Defines.SOLID_BBOX;        self.health = 240;        self.gib_health = -60;        self.mass = 250;        self.pain = berserk_pain;        self.die = berserk_die;        self.monsterinfo.stand = berserk_stand;        self.monsterinfo.walk = berserk_walk;        self.monsterinfo.run = berserk_run;        self.monsterinfo.dodge = null;        self.monsterinfo.attack = null;        self.monsterinfo.melee = berserk_melee;        self.monsterinfo.sight = berserk_sight;        self.monsterinfo.search = berserk_search;        self.monsterinfo.currentmove = berserk_move_stand;        self.monsterinfo.scale = MODEL_SCALE;        GameBase.gi.linkentity(self);        GameAI.walkmonster_start.think(self);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -