Skip to content

Commit

Permalink
Add support for delay explosion spell
Browse files Browse the repository at this point in the history
  • Loading branch information
raydienull committed Dec 2, 2024
1 parent e488b8a commit 81a1508
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3944,3 +3944,6 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.
- Added: Added NOREJOIN tag for corpses, If the NOREJOIN tag is one, the player cannot come back to life on that corpse. That is, the player comes back to life but not on the corpse.
This tag does not prevent the player from coming back to life, it just prevents them from respawning on that corpse. The player always comes back to life, but not on that corpse.
- Fixed: If you are around an entity that you own and you are trying to open a bank next to a bank, the "bank" command is perceived as a pet command and the bank does not open. There is no problem when you type "bank" after mounting the mount, but "bank" does not work when you dismount. (Issue #1331)

02-11-2024, raydie
- Added: Add LAYER_SPELL_Explosion for use delayed explosion spell. Now if set Duration to spell explosion, these duration is the delay to execute the explosion (From UOGuide, explosion spell: 2 second delay between targetting and explosion)
37 changes: 28 additions & 9 deletions src/game/chars/CCharSpell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,14 @@ bool CChar::Spell_Equip_OnTick( CItem * pItem )
break;
}

case SPELL_Explosion:
{
iEffect = iLevel;
iDmgType = DAMAGE_MAGIC | DAMAGE_FIRE;
Effect(EFFECT_OBJ, ITEMID_FX_EXPLODE_3, pItem->m_uidLink.CharFind(), 10, 16);
}
break;

case SPELL_Strangle:
{
/*
Expand Down Expand Up @@ -2047,6 +2055,10 @@ CItem * CChar::Spell_Effect_Create( SPELL_TYPE spell, LAYER_TYPE layer, int iEff
if ( layer == LAYER_SPELL_STATS && spell != pSpellPrev->m_itSpell.m_spell && IsSetMagicFlags(MAGICF_STACKSTATS) )
continue;

// If spell is explosion and there's already an explosion timer, dont remove it
if ( spell == SPELL_Explosion && layer == LAYER_SPELL_Explosion )
continue;

pSpellPrev->Delete();
break;
}
Expand All @@ -2055,15 +2067,16 @@ CItem * CChar::Spell_Effect_Create( SPELL_TYPE spell, LAYER_TYPE layer, int iEff
CItem *pSpell = CItem::CreateBase(pSpellDef ? pSpellDef->m_idSpell : ITEMID_RHAND_POINT_NW);
ASSERT(pSpell);

switch ( layer )
{
case LAYER_FLAG_Criminal: pSpell->SetName("Criminal Timer"); break;
case LAYER_FLAG_PotionUsed: pSpell->SetName("Potion Cooldown"); break;
case LAYER_FLAG_Drunk: pSpell->SetName("Drunk Effect"); break;
case LAYER_FLAG_Hallucination: pSpell->SetName("Hallucination Effect"); break;
case LAYER_FLAG_Murders: pSpell->SetName("Murder Decay"); break;
default: break;
}
switch ( layer )
{
case LAYER_FLAG_Criminal: pSpell->SetName("Criminal Timer"); break;
case LAYER_FLAG_PotionUsed: pSpell->SetName("Potion Cooldown"); break;
case LAYER_FLAG_Drunk: pSpell->SetName("Drunk Effect"); break;
case LAYER_FLAG_Hallucination: pSpell->SetName("Hallucination Effect"); break;
case LAYER_FLAG_Murders: pSpell->SetName("Murder Decay"); break;
case LAYER_SPELL_Explosion: pSpell->SetName("Explosion Timer"); break;
default: break;
}

g_World.m_uidNew = pSpell->GetUID();
pSpell->SetAttr(pSpellDef ? ATTR_NEWBIE|ATTR_MAGIC : ATTR_NEWBIE);
Expand Down Expand Up @@ -3911,6 +3924,12 @@ bool CChar::OnSpellEffect( SPELL_TYPE spell, CChar * pCharSrc, int iSkillLevel,
}
break;

case SPELL_Explosion:
// if not a potion and have duration, create effect
if (!fPotion && iDuration > 0)
Spell_Effect_Create( SPELL_Explosion, LAYER_SPELL_Explosion, iEffect, iDuration, pCharSrc );
break;

case SPELL_Invis:
Spell_Effect_Create( spell, fPotion ? LAYER_FLAG_Potion : LAYER_SPELL_Invis, iEffect, iDuration, pCharSrc );
break;
Expand Down
5 changes: 3 additions & 2 deletions src/game/uo_files/uofiles_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,10 @@ enum LAYER_TYPE : unsigned char // defined by UO. Only one item can be in a slot

//Individual Spell Layers
LAYER_SPELL_Mana_Drain,
LAYER_SPELL_Explosion,

LAYER_STORAGE, //80 New Storage layer, can equip t_container and t_container_locked.
LAYER_STABLE, //81 New stable layer, now stabled pets will be stored in this layer of the player instead of npc's itself.
LAYER_STORAGE, // New Storage layer, can equip t_container and t_container_locked.
LAYER_STABLE, // New stable layer, now stabled pets will be stored in this layer of the player instead of npc's itself.
LAYER_QTY
};

Expand Down

0 comments on commit 81a1508

Please sign in to comment.