Created
January 21, 2016 14:59
-
-
Save dbjorkholm/a02c59318b3ca8291ebf to your computer and use it in GitHub Desktop.
[TFS 1.2] Combat Parameter - COMBAT_PARAM_PVPDAMAGE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 01482b2ce8ff82213ff85d5b7097ec5f403aa967 Thu, 21 Jan 2016 15:54:46 2001 | |
From: Daniel Björkholm <[email protected]> | |
Date: Thu, 21 Jan 2016 15:54:46 +0100 | |
Subject: [PATCH] test | |
--- | |
combat.cpp | 11 ++++++++++- | |
combat.h | 5 ++++- | |
enums.h | 3 ++- | |
luascript.cpp | 3 ++- | |
4 files changed, 18 insertions(+), 4 deletions(-) | |
diff --git a/combat.cpp b/combat.cpp | |
index c0656ec..4aeef44 100644 | |
--- a/combat.cpp | |
+++ b/combat.cpp | |
@@ -441,6 +441,11 @@ bool Combat::setParam(CombatParam_t param, uint32_t value) | |
params.useCharges = (value != 0); | |
return true; | |
} | |
+ | |
+ case COMBAT_PARAM_PVPDAMAGE: { | |
+ params.pvpDamage = value; | |
+ return true; | |
+ } | |
} | |
return false; | |
} | |
@@ -502,7 +507,10 @@ void Combat::CombatHealthFunc(Creature* caster, Creature* target, const CombatPa | |
Player* targetPlayer = target->getPlayer(); | |
if (targetPlayer && caster->getPlayer() && targetPlayer->getSkull() != SKULL_BLACK) { | |
damage.primary.value /= 2; | |
+ damage.primary.value *= params.pvpDamage / 100.; | |
+ | |
damage.secondary.value /= 2; | |
+ damage.secondary.value *= params.pvpDamage / 100.; | |
} | |
} | |
@@ -519,6 +527,7 @@ void Combat::CombatManaFunc(Creature* caster, Creature* target, const CombatPara | |
if (damage.primary.value < 0) { | |
if (caster && caster->getPlayer() && target->getPlayer()) { | |
damage.primary.value /= 2; | |
+ damage.primary.value *= params.pvpDamage / 100.; | |
} | |
} | |
@@ -1397,4 +1406,4 @@ void MagicField::onStepInField(Creature* creature) | |
creature->addCondition(conditionCopy); | |
} | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/combat.h b/combat.h | |
index c1e9ff2..95110a2 100644 | |
--- a/combat.h | |
+++ b/combat.h | |
@@ -75,6 +75,7 @@ struct CombatParams { | |
impactEffect = CONST_ME_NONE; | |
distanceEffect = CONST_ANI_NONE; | |
useCharges = false; | |
+ pvpDamage = 100; | |
origin = ORIGIN_SPELL; | |
} | |
@@ -87,6 +88,8 @@ struct CombatParams { | |
uint16_t itemId; | |
+ uint32_t pvpDamage; | |
+ | |
ConditionType_t dispelType; | |
CombatType_t combatType; | |
CombatOrigin origin; | |
@@ -379,4 +382,4 @@ class MagicField final : public Item | |
int64_t createTime; | |
}; | |
-#endif | |
\ No newline at end of file | |
+#endif | |
diff --git a/enums.h b/enums.h | |
index 3b24e71..fbcdfb5 100644 | |
--- a/enums.h | |
+++ b/enums.h | |
@@ -166,6 +166,7 @@ enum CombatParam_t { | |
COMBAT_PARAM_AGGRESSIVE, | |
COMBAT_PARAM_DISPEL, | |
COMBAT_PARAM_USECHARGES, | |
+ COMBAT_PARAM_PVPDAMAGE, | |
}; | |
enum CallBackParam_t { | |
@@ -569,4 +570,4 @@ typedef std::list<MarketOffer> MarketOfferList; | |
typedef std::list<HistoryMarketOffer> HistoryMarketOfferList; | |
typedef std::list<ShopInfo> ShopInfoList; | |
-#endif | |
\ No newline at end of file | |
+#endif | |
diff --git a/luascript.cpp b/luascript.cpp | |
index 692840a..349ee39 100644 | |
--- a/luascript.cpp | |
+++ b/luascript.cpp | |
@@ -1087,6 +1087,7 @@ void LuaScriptInterface::registerFunctions() | |
registerEnum(COMBAT_PARAM_AGGRESSIVE) | |
registerEnum(COMBAT_PARAM_DISPEL) | |
registerEnum(COMBAT_PARAM_USECHARGES) | |
+ registerEnum(COMBAT_PARAM_PVPDAMAGE) | |
registerEnum(CONDITION_NONE) | |
registerEnum(CONDITION_POISON) | |
@@ -12259,4 +12260,4 @@ void LuaEnvironment::executeTimerEvent(uint32_t eventIndex) | |
for (auto parameter : timerEventDesc.parameters) { | |
luaL_unref(m_luaState, LUA_REGISTRYINDEX, parameter); | |
} | |
-} | |
\ No newline at end of file | |
+} | |
-- | |
2.6.3.windows.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be adjusted into config.lua? So could end like this ?
combat:setParameter(COMBAT_PARAM_PVPDAMAGE, configManager.getNumber(configKeys.pvpDamage))