REGISTER_MONSTER(
/* MON_##id */ ZOMBIE,
/* function */ m_zombie,
-/* spawnflags */ 0,
+/* spawnflags */ MON_FLAG_MELEE,
/* mins,maxs */ '-18 -18 -25', '18 18 47',
/* model */ "zombie.dpm",
/* netname */ "zombie",
self.touch = MonsterTouch;
}
+void zombie_blockend()
+{
+ if(self.health <= 0)
+ return;
+
+ monsters_setframe(zombie_anim_blockend);
+ self.armorvalue = 0;
+ self.m_armor_blockpercent = autocvar_g_monsters_armor_blockpercent;
+}
+
+float zombie_block()
+{
+ monsters_setframe(zombie_anim_blockstart);
+ self.armorvalue = 100;
+ self.m_armor_blockpercent = 0.9;
+ self.state = MONSTER_STATE_ATTACK_MELEE; // freeze monster
+ self.attack_finished_single = time + 2.1;
+
+ defer(2, zombie_blockend);
+
+ return TRUE;
+}
+
float zombie_attack(float attack_type)
{
switch(attack_type)
chosen_anim = zombie_anim_attackstanding2;
else
chosen_anim = zombie_anim_attackstanding3;
-
- monsters_setframe(chosen_anim);
-
- self.attack_finished_single = time + MON_CVAR(zombie, attack_melee_delay);
- monster_melee(self.enemy, MON_CVAR(zombie, attack_melee_damage), 0.3, DEATH_MONSTER_ZOMBIE_MELEE, TRUE);
+ if(random() < 0.3 && self.health < 75 && self.enemy.health > 10)
+ return zombie_block();
- return TRUE;
+ return monster_melee(self.enemy, MON_CVAR(zombie, attack_melee_damage), chosen_anim, self.attack_range, MON_CVAR(zombie, attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, TRUE);
}
case MONSTER_ATTACK_RANGED:
{
makevectors(self.angles);
- if(monster_leap(zombie_anim_attackleap, zombie_attack_leap_touch, v_forward * MON_CVAR(zombie, attack_leap_speed) + '0 0 200', MON_CVAR(zombie, attack_leap_delay)))
- return TRUE;
+ return monster_leap(zombie_anim_attackleap, zombie_attack_leap_touch, v_forward * MON_CVAR(zombie, attack_leap_speed) + '0 0 200', MON_CVAR(zombie, attack_leap_delay));
}
}
}
case MR_DEATH:
{
+ self.armorvalue = 0;
+ self.m_armor_blockpercent = autocvar_g_monsters_armor_blockpercent;
monsters_setframe((random() > 0.5) ? zombie_anim_deathback1 : zombie_anim_deathfront1);
return TRUE;
}
case MR_SETUP:
{
if not(self.health) self.health = MON_CVAR(zombie, health);
-
+
+ if(self.spawnflags & MONSTERFLAG_NORESPAWN)
+ self.spawnflags &= ~MONSTERFLAG_NORESPAWN; // zombies always respawn
+
+ self.monster_loot = spawnfunc_item_health_medium;
self.monster_attackfunc = zombie_attack;
monsters_setframe(zombie_anim_spawn);
self.spawn_time = time + 2.1;
self.spawnshieldtime = self.spawn_time;
- self.respawntime = 0.1;
+ self.respawntime = 0.2;
return TRUE;
}