Skip to content

Commit

Permalink
Familiars dying will unsummon
Browse files Browse the repository at this point in the history
Also fixed the unsummon effect for new players
  • Loading branch information
Loobinex committed Oct 10, 2024
1 parent 676367c commit 5607b72
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/thing_creature.c
Original file line number Diff line number Diff line change
Expand Up @@ -5839,6 +5839,16 @@ TngUpdateRet update_creature(struct Thing *thing)
{
SYNCDBG(19,"Starting for %s index %d",thing_model_name(thing),(int)thing->index);
TRACE_THING(thing);
struct CreatureControl* cctrl = creature_control_get_from_thing(thing);
if (cctrl->unsummon_turn > 0)
{
if ((cctrl->unsummon_turn < game.play_gameturn) || (thing->health < 0))
{
create_effect_around_thing(thing, ball_puff_effects[thing->owner]);
kill_creature(thing, INVALID_THING, -1, CrDed_NotReallyDying | CrDed_NoEffects);
return TUFRet_Deleted;
}
}
if ((thing->active_state == CrSt_CreatureUnconscious) && subtile_is_door(thing->mappos.x.stl.num, thing->mappos.y.stl.num))
{
SYNCDBG(8,"Killing unconscious %s index %d on door block.",thing_model_name(thing),(int)thing->index);
Expand All @@ -5850,19 +5860,12 @@ TngUpdateRet update_creature(struct Thing *thing)
kill_creature(thing, INVALID_THING, -1, CrDed_Default);
return TUFRet_Deleted;
}
struct CreatureControl* cctrl = creature_control_get_from_thing(thing);
if (creature_control_invalid(cctrl))
{
WARNLOG("Killing %s index %d with invalid control %d.(%d)",thing_model_name(thing),(int)thing->index, thing->ccontrol_idx, game.conf.rules.game.creatures_count);
kill_creature(thing, INVALID_THING, -1, CrDed_Default);
return TUFRet_Deleted;
}
if ((cctrl->unsummon_turn > 0) && (cctrl->unsummon_turn < game.play_gameturn))
{
create_effect_around_thing(thing, (TngEff_BallPuffRed + thing->owner));
kill_creature(thing, INVALID_THING, -1, CrDed_NotReallyDying| CrDed_NoEffects);
return TUFRet_Deleted;
}
process_armageddon_influencing_creature(thing);

if (cctrl->frozen_on_hit > 0)
Expand Down

0 comments on commit 5607b72

Please sign in to comment.