Skip to content

Commit

Permalink
Fixed issue with cube not targeting monsters. Updated cube damage to …
Browse files Browse the repository at this point in the history
…be based on wisdom.... and not suck. Added functions to remove and reapply buff effects to fix wizard teleport.
  • Loading branch information
cabbruzzese committed Aug 13, 2016
1 parent 5e338b7 commit 63c4033
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 7 deletions.
4 changes: 2 additions & 2 deletions h2/constant.hc
Expand Up @@ -236,8 +236,8 @@ float CLASS_FINAL_BOSS = 5;
float BUFFTYPE_NORMAL = 0;
float BUFFTYPE_LARGE = 1;
float BUFFTYPE_SPECTRE = 2;
float BUFFTYPE_LEADER = 4;

float BUFFTYPE_GHOST = 4;
float BUFFTYPE_LEADER = 8;

float MAX_HEALTH = 200;

Expand Down
6 changes: 3 additions & 3 deletions h2/cube.hc
Expand Up @@ -24,14 +24,14 @@ float cube_find_target(void)

if (deathmatch == 1 && item.classname == "player") //target other players in deathmatch
targetGood = TRUE;
if (item.owner.classname != "player" && item.classname == "player") //target players if owned by monster
if (self.owner.classname != "player" && item.classname == "player") //target players if owned by monster
targetGood = TRUE;
if (item.owner.classname == "player" && item.flags & FL_MONSTER) //target monsters if owned by player
if (self.owner.classname == "player" && item.flags & FL_MONSTER) //target monsters if owned by player
targetGood = TRUE;

if (item.health <= 0) //Don't shoot dead bodies
targetGood = FALSE;
if (item.controller.classname == self.classname) //don't shoot our own summons or anything summoned by our friends
if (item.controller.classname == self.controller.classname) //don't shoot our own summons or anything summoned by our friends
targetGood = FALSE;

if (targetGood)
Expand Down
10 changes: 9 additions & 1 deletion h2/fireball.hc
Expand Up @@ -33,6 +33,7 @@ void FireFizzle (void)
void() fireballTouch =
{
local float damg;
float wismod;

if (other == self.owner)
return; // don't explode on owner
Expand All @@ -44,7 +45,14 @@ void() fireballTouch =
}

if (self.dmg == -1)
damg = random(5,10);
{
damg = random(9,18);
if (self.owner.classname == "cube_of_force" && self.owner.owner.classname == "player")
{
wismod = self.owner.owner.wisdom;
damg = random(wismod / 2, wismod);
}
}
else if (self.dmg)
damg = self.dmg;
else
Expand Down
23 changes: 23 additions & 0 deletions h2/monsters.hc
Expand Up @@ -334,6 +334,27 @@ void() swimmonster_start =
};
*/

void ApplyMonsterBuffEffect(entity monst)
{
if (monst.bufftype & BUFFTYPE_LEADER)
self.effects(+)EF_DIMLIGHT;

if (monst.bufftype & BUFFTYPE_SPECTRE)
self.drawflags(+)DRF_TRANSLUCENT;
if (monst.bufftype & BUFFTYPE_GHOST)
self.drawflags(+)MLS_ABSLIGHT;
}
void RemoveMonsterBuffEffect(entity monst)
{
if (monst.bufftype & BUFFTYPE_LEADER)
self.effects(-)EF_DIMLIGHT;

if (monst.bufftype & BUFFTYPE_SPECTRE)
self.drawflags(-)DRF_TRANSLUCENT;
if (monst.bufftype & BUFFTYPE_GHOST)
self.drawflags(-)MLS_ABSLIGHT;
}

//Make monster larger and stronger
void ApplyLargeMonster(entity monst)
{
Expand Down Expand Up @@ -448,6 +469,8 @@ void ApplySpectreMonster(entity monst)
self.experience_value *= 1.33;

self.drawflags(+)MLS_ABSLIGHT;

self.bufftype(+)BUFFTYPE_GHOST;
}

self = oself; //restore scope
Expand Down
Binary file modified h2/progs.dat
Binary file not shown.
10 changes: 9 additions & 1 deletion h2/skullwiz.hc
Expand Up @@ -715,6 +715,9 @@ void skullwiz_blinkin(void)
self.drawflags (-) SCALE_TYPE_XYONLY;
self.drawflags (+) SCALE_ORIGIN_BOTTOM;

//restore monster effects
ApplyMonsterBuffEffect(self);

skullwiz_run();
}

Expand Down Expand Up @@ -893,11 +896,16 @@ void skullwiz_blink(void) [++ $sktele2..$sktele30]
self.scale = self.tempscale;
}


//temporarily remove monster effects
// Must happen before teleport in order to not break the SCALE_TYPE_MASKOUT effect
RemoveMonsterBuffEffect(self);

//self.drawflags = (self.drawflags & SCALE_TYPE_MASKOUT) | SCALE_TYPE_XYONLY;
//replacing explicite flags with adding/removing Teleport related flags
self.drawflags (+) SCALE_TYPE_MASKOUT;
self.drawflags (+) SCALE_TYPE_XYONLY;
self.drawflags (-) SCALE_ORIGIN_BOTTOM;
self.drawflags (-) SCALE_ORIGIN_BOTTOM;

self.solid = SOLID_NOT;
self.th_pain=SUB_Null;
Expand Down

0 comments on commit 63c4033

Please sign in to comment.