1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

vcmi: replace archery and offence to new bonus

Add PERCENTAGE_DAMAGE_BOOST bonus, which will work exactly as old
archery or offence. Subtype is actually boolean which select
ranged (1) and melee (0)
This commit is contained in:
Konstantin 2023-02-13 02:16:42 +03:00
parent 4a89418ada
commit 0ed89e77d4
7 changed files with 30 additions and 24 deletions

View File

@ -912,8 +912,8 @@
{
"bonuses" : [
{
"subtype" : "skill.archery",
"type" : "SECONDARY_SKILL_PREMY",
"type" : "PERCENTAGE_DAMAGE_BOOST",
"subtype" : 1,
"val" : 5,
"valueType" : "ADDITIVE_VALUE",
"limiters" : [
@ -938,8 +938,8 @@
{
"bonuses" : [
{
"subtype" : "skill.archery",
"type" : "SECONDARY_SKILL_PREMY",
"type" : "PERCENTAGE_DAMAGE_BOOST",
"subtype" : 1,
"val" : 10,
"valueType" : "ADDITIVE_VALUE",
"limiters" : [
@ -964,8 +964,8 @@
{
"bonuses" : [
{
"subtype" : "skill.archery",
"type" : "SECONDARY_SKILL_PREMY",
"type" : "PERCENTAGE_DAMAGE_BOOST",
"subtype" : 1,
"val" : 15,
"valueType" : "ADDITIVE_VALUE",
"limiters" : [

View File

@ -403,6 +403,11 @@
}
},
"PERCENTAGE_DAMAGE_BOOST":
{
"hidden": true
},
"RECEPTIVE":
{
"graphics":

View File

@ -12,11 +12,12 @@
"specialty" : {
"bonuses" : {
"archery" : {
"subtype" : "skill.archery",
"type" : "SECONDARY_SKILL_PREMY",
"type" : "PERCENTAGE_DAMAGE_BOOST",
"subtype" : 1,
"updater" : "TIMES_HERO_LEVEL",
"val" : 5,
"valueType" : "PERCENT_TO_BASE"
"valueType" : "PERCENT_TO_TARGET_TYPE",
"targetSourceType" : "SECONDARY_SKILL"
}
}
}

View File

@ -95,11 +95,12 @@
"specialty" : {
"bonuses" : {
"offence" : {
"subtype" : "skill.offence",
"type" : "SECONDARY_SKILL_PREMY",
"subtype" : 0,
"type" : "PERCENTAGE_DAMAGE_BOOST",
"updater" : "TIMES_HERO_LEVEL",
"val" : 5,
"valueType" : "PERCENT_TO_BASE"
"valueType" : "PERCENT_TO_TARGET_TYPE",
"targetSourceType" : "SECONDARY_SKILL"
}
}
}

View File

@ -31,8 +31,8 @@
"base" : {
"effects" : {
"main" : {
"subtype" : "skill.archery",
"type" : "SECONDARY_SKILL_PREMY",
"type" : "PERCENTAGE_DAMAGE_BOOST",
"subtype" : 1,
"valueType" : "BASE_NUMBER"
}
}
@ -645,8 +645,8 @@
"base" : {
"effects" : {
"main" : {
"subtype" : "skill.offence",
"type" : "SECONDARY_SKILL_PREMY",
"subtype" : 0,
"type" : "PERCENTAGE_DAMAGE_BOOST",
"valueType" : "BASE_NUMBER"
}
}

View File

@ -334,6 +334,7 @@ public:
BONUS_NAME(LIMITED_SHOOTING_RANGE) /*limits range of shooting creatures, doesn't adjust any other mechanics (half vs full damage etc). val - range in hexes, additional info - optional new range for broken arrow mechanic */\
BONUS_NAME(LEARN_BATTLE_SPELL_CHANCE) /*skill-agnostic eagle eye chance. subtype = 0 - from enemy, 1 - TODO: from entire battlefield*/\
BONUS_NAME(LEARN_BATTLE_SPELL_LEVEL_LIMIT) /*skill-agnostic eagle eye limit, subtype - school (-1 for all), others TODO*/\
BONUS_NAME(PERCENTAGE_DAMAGE_BOOST) /*skill-agnostic archery and offence, subtype is 0 for offence and 1 for archery*/\
/* end of list */

View File

@ -201,18 +201,16 @@ double DamageCalculator::getAttackBlessFactor() const
double DamageCalculator::getAttackOffenseArcheryFactor() const
{
if(info.shooting)
{
const std::string cachingStrArchery = "type_SECONDARY_SKILL_PREMYs_ARCHERY";
static const auto selectorArchery = Selector::typeSubtype(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::ARCHERY);
const std::string cachingStrArchery = "type_PERCENTAGE_DAMAGE_BOOSTs_1";
static const auto selectorArchery = Selector::typeSubtype(Bonus::PERCENTAGE_DAMAGE_BOOST, 1);
return info.attacker->valOfBonuses(selectorArchery, cachingStrArchery) / 100.0;
}
else
{
const std::string cachingStrOffence = "type_SECONDARY_SKILL_PREMYs_OFFENCE";
static const auto selectorOffence = Selector::typeSubtype(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::OFFENCE);
return info.attacker->valOfBonuses(selectorOffence, cachingStrOffence) / 100.0;
}
const std::string cachingStrOffence = "type_PERCENTAGE_DAMAGE_BOOSTs_0";
static const auto selectorOffence = Selector::typeSubtype(Bonus::PERCENTAGE_DAMAGE_BOOST, 0);
return info.attacker->valOfBonuses(selectorOffence, cachingStrOffence) / 100.0;
}
double DamageCalculator::getAttackLuckFactor() const