Skip to content

Commit

Permalink
Merge branch 'LandSandBoat:base' into ci-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
clanofartisans committed Oct 1, 2024
2 parents b296557 + ba040c3 commit eba8f15
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ jobs:
path: build
key: ${{ runner.os }}-msvc64d
- name: Enable Modules
shell: cmd
shell: bash
run: |
python3 << EOF
with open("modules/init.txt", "w") as f:
Expand Down
3 changes: 2 additions & 1 deletion scripts/globals/bluemagic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ xi.spells.blue.applySpellDamage = function(caster, target, spell, dmg, params, t
dmg = dmg * xi.settings.main.BLUE_POWER
local attackType = params.attackType or xi.attackType.NONE
local damageType = params.damageType or xi.damageType.NONE
local extraTPGained = xi.combat.tp.calculateTPGainOnMagicalDamage(dmg, caster, target) * math.max(params.tphitslanded - 1, 0) -- Calculate extra TP gained from multihits. takeSpellDamage accounts for one already.
local tpHits = params.tphitslanded or 0
local extraTPGained = xi.combat.tp.calculateTPGainOnMagicalDamage(dmg, caster, target) * math.max(tpHits - 1, 0) -- Calculate extra TP gained from multihits. takeSpellDamage accounts for one already.

-- handle MDT, One For All, Liement
if attackType == xi.attackType.MAGICAL then
Expand Down
22 changes: 13 additions & 9 deletions scripts/globals/spells/damage_spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -778,21 +778,21 @@ xi.spells.damage.calculateAreaOfEffectResistance = function(target, spell)
end

xi.spells.damage.calculateNukeAbsorbOrNullify = function(target, spellElement)
local nukeAbsorbOrNullify = 1
local absorbElementMod = 0
local nullifyElementMod = 0
local nukeAbsorbOrNullify = 1
local absorbElementModValue = 0
local nullifyElementModValue = 0

if spellElement > xi.element.NONE then
absorbElementMod = xi.combat.element.absorbMod[spellElement]
nullifyElementMod = xi.combat.element.nullMod[spellElement]
absorbElementModValue = target:getMod(xi.combat.element.absorbMod[spellElement])
nullifyElementModValue = target:getMod(xi.combat.element.nullMod[spellElement])
end

-- Calculate chance for spell absorption.
local absorbChance = math.random(1, 100)
if
absorbChance <= target:getMod(xi.mod.ABSORB_DMG_CHANCE) or -- All damage.
absorbChance <= target:getMod(xi.mod.MAGIC_ABSORB) or -- Magical damage.
absorbChance <= target:getMod(absorbElementMod) -- Element damage.
absorbChance <= absorbElementModValue -- Element damage.
then
nukeAbsorbOrNullify = -1
end
Expand All @@ -802,7 +802,7 @@ xi.spells.damage.calculateNukeAbsorbOrNullify = function(target, spellElement)
if
nullifyChance <= target:getMod(xi.mod.NULL_DAMAGE) or -- All damage.
nullifyChance <= target:getMod(xi.mod.NULL_MAGICAL_DAMAGE) or -- Magical damage.
nullifyChance <= target:getMod(nullifyElementMod) -- Element damage.
nullifyChance <= nullifyElementModValue -- Element damage.
then
nukeAbsorbOrNullify = 0
end
Expand Down Expand Up @@ -1025,8 +1025,12 @@ xi.spells.damage.useDamageSpell = function(caster, target, spell)
finalDamage = utils.clamp(utils.stoneskin(target, finalDamage), -99999, 99999)
end

-- Handle Magic Absorb
if finalDamage < 0 then
-- Handle spell nullification message.
if nukeAbsorbOrNullify == 0 then
spell:setMsg(xi.msg.basic.MAGIC_RESIST)

-- Handle Magic Absorb message and HP recovery.
elseif finalDamage < 0 then
finalDamage = target:addHP(-finalDamage)
spell:setMsg(xi.msg.basic.MAGIC_RECOVERS_HP)

Expand Down
20 changes: 20 additions & 0 deletions sql/item_mods.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36856,16 +36856,20 @@ INSERT INTO `item_mods` VALUES (18276,23,20); -- ATT: 20
INSERT INTO `item_mods` VALUES (18276,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (18276,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (18276,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (18276,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (18276,506,50); -- EXTRA_DMG_CHANCE: 50
INSERT INTO `item_mods` VALUES (18276,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (18276,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Excalibur
INSERT INTO `item_mods` VALUES (18277,23,25); -- ATT: 25
INSERT INTO `item_mods` VALUES (18277,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (18277,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (18277,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (18277,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (18277,506,50); -- EXTRA_DMG_CHANCE: 50
INSERT INTO `item_mods` VALUES (18277,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (18277,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Valhalla
INSERT INTO `item_mods` VALUES (18281,256,4); -- AFTERMATH: 4
Expand Down Expand Up @@ -38072,8 +38076,10 @@ INSERT INTO `item_mods` VALUES (18639,23,30); -- ATT: 30
INSERT INTO `item_mods` VALUES (18639,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (18639,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (18639,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (18639,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (18639,506,50); -- EXTRA_DMG_CHANCE: 50
INSERT INTO `item_mods` VALUES (18639,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (18639,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Ragnarok
INSERT INTO `item_mods` VALUES (18640,25,30); -- ACC: 30
Expand Down Expand Up @@ -38186,9 +38192,11 @@ INSERT INTO `item_mods` VALUES (18653,23,35); -- ATT: 35
INSERT INTO `item_mods` VALUES (18653,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (18653,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (18653,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (18653,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (18653,506,50); -- EXTRA_DMG_CHANCE: 50
INSERT INTO `item_mods` VALUES (18653,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (18653,613,25); -- WSD+% (Knights Of Round): 25
INSERT INTO `item_mods` VALUES (18653,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Ragnarok
INSERT INTO `item_mods` VALUES (18654,25,35); -- ACC: 35
Expand Down Expand Up @@ -38312,9 +38320,11 @@ INSERT INTO `item_mods` VALUES (18667,23,35); -- ATT: 35
INSERT INTO `item_mods` VALUES (18667,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (18667,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (18667,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (18667,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (18667,506,130); -- EXTRA_DMG_CHANCE: 130
INSERT INTO `item_mods` VALUES (18667,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (18667,613,25); -- WSD+% (Knights Of Round): 25
INSERT INTO `item_mods` VALUES (18667,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Ragnarok
INSERT INTO `item_mods` VALUES (18668,25,35); -- ACC: 35
Expand Down Expand Up @@ -40858,9 +40868,11 @@ INSERT INTO `item_mods` VALUES (19748,23,40); -- ATT: 40
INSERT INTO `item_mods` VALUES (19748,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (19748,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (19748,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (19748,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (19748,506,130); -- EXTRA_DMG_CHANCE: 130
INSERT INTO `item_mods` VALUES (19748,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (19748,613,40); -- WSD+% (Knights Of Round): 40
INSERT INTO `item_mods` VALUES (19748,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Ragnarok
INSERT INTO `item_mods` VALUES (19749,25,40); -- ACC: 40
Expand Down Expand Up @@ -41372,9 +41384,11 @@ INSERT INTO `item_mods` VALUES (19841,23,40); -- ATT: 40
INSERT INTO `item_mods` VALUES (19841,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (19841,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (19841,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (19841,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (19841,506,130); -- EXTRA_DMG_CHANCE: 130
INSERT INTO `item_mods` VALUES (19841,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (19841,613,40); -- WSD+% (Knights Of Round): 40
INSERT INTO `item_mods` VALUES (19841,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Ragnarok
INSERT INTO `item_mods` VALUES (19842,25,40); -- ACC: 40
Expand Down Expand Up @@ -42259,18 +42273,22 @@ INSERT INTO `item_mods` VALUES (20645,23,40); -- ATT: 40
INSERT INTO `item_mods` VALUES (20645,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (20645,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (20645,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (20645,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (20645,506,130); -- EXTRA_DMG_CHANCE: 130
INSERT INTO `item_mods` VALUES (20645,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (20645,613,40); -- WSD+% (Knights Of Round): 40
INSERT INTO `item_mods` VALUES (20645,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Excalibur
INSERT INTO `item_mods` VALUES (20646,23,40); -- ATT: 40
INSERT INTO `item_mods` VALUES (20646,256,3); -- AFTERMATH: 3
INSERT INTO `item_mods` VALUES (20646,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (20646,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (20646,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (20646,506,130); -- EXTRA_DMG_CHANCE: 130
INSERT INTO `item_mods` VALUES (20646,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (20646,613,40); -- WSD+% (Knights Of Round): 40
INSERT INTO `item_mods` VALUES (20646,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Murgleis
INSERT INTO `item_mods` VALUES (20647,30,30); -- MACC: 30
Expand Down Expand Up @@ -42374,9 +42392,11 @@ INSERT INTO `item_mods` VALUES (20685,23,60); -- ATT: 60
INSERT INTO `item_mods` VALUES (20685,256,17); -- AFTERMATH: 17
INSERT INTO `item_mods` VALUES (20685,355,43); -- ADDS_WEAPONSKILL: 43
INSERT INTO `item_mods` VALUES (20685,431,1); -- ITEM_ADDEFFECT_TYPE: DAMAGE
INSERT INTO `item_mods` VALUES (20685,499,7); -- ITEM_SUBEFFECT: ENLIGHT
INSERT INTO `item_mods` VALUES (20685,506,130); -- EXTRA_DMG_CHANCE: 130
INSERT INTO `item_mods` VALUES (20685,507,300); -- OCC_DO_EXTRA_DMG: 300
INSERT INTO `item_mods` VALUES (20685,613,40); -- WSD+% (Knights Of Round): 40
INSERT INTO `item_mods` VALUES (20685,950,7); -- ITEM_ADDEFFECT_ELEMENT: ELEMENT_LIGHT -- TODO: This should be "slashing", change once we have support for physical damage types.

-- Murgleis
INSERT INTO `item_mods` VALUES (20686,30,40); -- MACC: 40
Expand Down
22 changes: 16 additions & 6 deletions src/map/entities/battleentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,17 +779,27 @@ uint16 CBattleEntity::ATT(SLOTTYPE slot)
int32 ATT = 8 + m_modStat[Mod::ATT];
auto ATTP = m_modStat[Mod::ATTP];
auto* weapon = dynamic_cast<CItemWeapon*>(m_Weapons[slot]);
if (weapon && weapon->isTwoHanded())

// https://www.bg-wiki.com/ffxi/Strength
if (weapon && weapon->isTwoHanded()) // 2-handed weapon
{
ATT += (STR() * 3) / 4;
ATT += STR();
}
else if (weapon && weapon->isHandToHand())
else if (weapon && weapon->isHandToHand()) // H2H Weapon
{
ATT += (STR() * 5) / 8;
ATT += STR() * 3 / 4;
}
else
else if (slot == SLOT_RANGED || slot == SLOT_AMMO) // Ranged/ammo weapon.
{
ATT += STR();
}
else if (slot == SLOT_MAIN) // 1-handed weapon in main slot.
{
ATT += STR();
}
else // 1-handed weapon in sub slot.
{
ATT += (STR() * 3) / 4;
ATT += STR() / 2;
}

if (this->StatusEffectContainer->HasStatusEffect(EFFECT_ENDARK))
Expand Down
2 changes: 1 addition & 1 deletion src/map/entities/charentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@ void CCharEntity::OnRangedAttack(CRangeState& state, action_t& action)
if (slot == SLOT_RANGED)
{
auto attackType = (state.IsRapidShot()) ? PHYSICAL_ATTACK_TYPE::RAPID_SHOT : PHYSICAL_ATTACK_TYPE::RANGED;
totalDamage = attackutils::CheckForDamageMultiplier(this, PItem, totalDamage, attackType, true);
totalDamage = attackutils::CheckForDamageMultiplier(this, PItem, totalDamage, attackType, slot, true);
}
actionTarget.param =
battleutils::TakePhysicalDamage(this, PTarget, PHYSICAL_ATTACK_TYPE::RANGED, totalDamage, false, slot, realHits, nullptr, true, true);
Expand Down

0 comments on commit eba8f15

Please sign in to comment.