Skip to content

Commit

Permalink
Implementing Amplified DMG Buff (MotocalDevelopers#383)
Browse files Browse the repository at this point in the history
* Added Seraphic Buff UI for profile

* Added Seraphic Buff UI for chara

* Implemented Seraphic Buff Logic

* Updated translation keys

* Updated to include desired syntax

* Fix

* fix result.js

* Update translate.js

* Update profile.js

* Update translate.js

* Moved to bottom of the list and updated translation key to remove counterattack

* Change logic for displaying value

* Update translate.js

* Display value
  • Loading branch information
OrkunKocyigit authored and エッケザックス committed Dec 5, 2019
1 parent fad2584 commit 2c6415e
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ typings/
.serverless

Jetbrains directories
.idea/
.idea/
.vscode/launch.json
7 changes: 7 additions & 0 deletions src/chara.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ var Chara = CreateClass({
elementBuff: 0,
otherBuff: 0,
otherBuff2: 0,
damageUPOnlyNormalDamageBuff: 0,
additionalDamageBuff: 0,
supplementalDamageBuff: 0,
daBuff: 0,
Expand Down Expand Up @@ -695,6 +696,12 @@ var Chara = CreateClass({
<td><InputGroup><FormControl componentClass="select" value={this.state.ougiDamageLimitBuff}
onChange={this.handleSelectEvent.bind(this, "ougiDamageLimitBuff")}>{selector.buffLevel}</FormControl><InputGroup.Addon>%</InputGroup.Addon>
</InputGroup></td>
</tr>,
<tr key="damageUPOnlyNormalDamageBuff">
<th className="bg-primary">{intl.translate("与ダメージUPバフ(通常攻撃のみ)", locale)}</th>
<td><InputGroup><FormControl componentClass="select" value={this.state.damageUPOnlyNormalDamageBuff}
onChange={this.handleSelectEvent.bind(this, "damageUPOnlyNormalDamageBuff")}>{selector.buffLevel}</FormControl><InputGroup.Addon>%</InputGroup.Addon>
</InputGroup></td>
</tr>
]
: null}
Expand Down
23 changes: 17 additions & 6 deletions src/global_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,13 +669,17 @@ module.exports.calcBasedOneSummon = function (summonind, prof, buff, totals) {
var daRate = Math.min(1.0, Math.floor(totalDA * 100) / 100);
var expectedAttack = 3.0 * taRate + (1.0 - taRate) * (2.0 * daRate + (1.0 - daRate));

var damageUP = totals[key]["charaUniqueDamageUP"];
// damageUP is 与ダメージ上昇(e.g. seraphic weapons)
// The final damage will be boosted by the this.
let damageUP = 0;
let damageUPOnlyNormalDamage = totals[key]["charaUniqueDamageUP"];
if (totals[key]["typeBonus"] == 1.5) {
// Supplemental damage rise support ability does not overlap with Tenshi skill (the strongest effect overwrites the lesser)
damageUP += Math.max(totals[key]["tenshiDamageUP"], totals[key]["charaDamageUP"]);
damageUP += 0.01 * totalSummon["tenshiDamageUP"];
damageUPOnlyNormalDamage += totals[key]["damageUPOnlyNormalBuff"] + buff["damageUPOnlyNormal"];
}

var criticalArray = {};
var criticalRatio = 1.0;
if (totals[key]["typeBonus"] == 1.5
Expand Down Expand Up @@ -830,10 +834,10 @@ module.exports.calcBasedOneSummon = function (summonind, prof, buff, totals) {
}

// "damage" is a single attack damage without additional damage (with attenuation and skill correction)
var damage = module.exports.calcDamage(summedAttack, totalSkillCoeff, criticalRatio, prof.enemyDefense, prof.defenseDebuff, enemyResistance, additionalDamage, damageUP, normalDamageLimitValues);
var damage = module.exports.calcDamage(summedAttack, totalSkillCoeff, criticalRatio, prof.enemyDefense, prof.defenseDebuff, enemyResistance, additionalDamage, damageUP + damageUPOnlyNormalDamage, normalDamageLimitValues);

// Use damage in case of no critical to correct skill expectation
var damageWithoutCritical = module.exports.calcDamage(summedAttack, totalSkillCoeff, 1.0, prof.enemyDefense, prof.defenseDebuff, enemyResistance, additionalDamage, damageUP, normalDamageLimitValuesWithoutCritical);
var damageWithoutCritical = module.exports.calcDamage(summedAttack, totalSkillCoeff, 1.0, prof.enemyDefense, prof.defenseDebuff, enemyResistance, additionalDamage, damageUP + damageUPOnlyNormalDamage, normalDamageLimitValuesWithoutCritical);

// Expected critical skill ratio
var effectiveCriticalRatio = damage / damageWithoutCritical;
Expand Down Expand Up @@ -968,6 +972,7 @@ module.exports.calcBasedOneSummon = function (summonind, prof, buff, totals) {
coeffs["ougiDamageUP"] = ougiDamageUP;
coeffs["chainDamageUP"] = chainDamageUP;
coeffs["damageUP"] = damageUP;
coeffs["damageUPOnlyNormalDamage"] = damageUPOnlyNormalDamage;
coeffs["damageLimit"] = damageLimit;
coeffs["ougiDamageLimit"] = ougiDamageLimit;
coeffs["chainDamageLimit"] = chainDamageLimit;
Expand Down Expand Up @@ -1482,6 +1487,7 @@ module.exports.getTotalBuff = function (prof) {
element: 0.0,
other: 0.0,
other2: 0.0,
damageUPOnlyNormal: 0.0,
zenith1: 0.0,
zenith2: 0.0,
zenithDA: 0.0,
Expand Down Expand Up @@ -1520,6 +1526,7 @@ module.exports.getTotalBuff = function (prof) {
if (!isNaN(prof.daBuff)) totalBuff["da"] += 0.01 * parseFloat(prof.daBuff);
if (!isNaN(prof.taBuff)) totalBuff["ta"] += 0.01 * parseFloat(prof.taBuff);
if (!isNaN(prof.otherBuff2)) totalBuff["other2"] += 0.01 * parseInt(prof.otherBuff2);
if (!isNaN(prof.damageUPOnlyNormalBuff)) totalBuff["damageUPOnlyNormal"] += 0.01 * parseInt(prof.damageUPOnlyNormalBuff);
if (!isNaN(prof.additionalDamageBuff)) totalBuff["additionalDamage"] += 0.01 * parseInt(prof.additionalDamageBuff);
if (!isNaN(prof.ougiGageUpOugiBuff)) totalBuff["ougiGageUpOugi"] += parseInt(prof.ougiGageUpOugiBuff);
if (!isNaN(prof.uplift)) totalBuff["uplift"] += 0.01 * parseInt(prof.uplift);
Expand Down Expand Up @@ -2261,6 +2268,7 @@ module.exports.getInitialTotals = function (prof, chara, summon) {
personalElementBuff: 0.0,
personalOtherBuff: 0.0,
personalOtherBuff2: 0.0,
personalDamageUPOnlyNormalBuff: 0.0,
personalHPBuff: 0.0,
personalDABuff: 0.0,
personalTABuff: 0.0,
Expand Down Expand Up @@ -2373,6 +2381,7 @@ module.exports.getInitialTotals = function (prof, chara, summon) {
elementBuffBoostBuff: 0,
otherBuff: djeetaBuffList["personalOtherBuff"],
otherBuff2: djeetaBuffList["personalOtherBuff2"],
damageUPOnlyNormalBuff: djeetaBuffList["personalDamageUPOnlyNormalBuff"],
HPBuff: djeetaBuffList["personalHPBuff"],
DABuff: djeetaBuffList["personalDABuff"],
TABuff: djeetaBuffList["personalTABuff"],
Expand Down Expand Up @@ -2432,6 +2441,7 @@ module.exports.getInitialTotals = function (prof, chara, summon) {
elementBuff: 0.0,
otherBuff: 0.0,
otherBuff2: 0.0,
damageUPOnlyNormalDamageBuff: 0.0,
hpBuff: 0.0,
daBuff: 0.0,
taBuff: 0.0,
Expand Down Expand Up @@ -2545,6 +2555,7 @@ module.exports.getInitialTotals = function (prof, chara, summon) {
elementBuffBoostBuff: 0,
otherBuff: charaBuffList["otherBuff"],
otherBuff2: charaBuffList["otherBuff2"],
damageUPOnlyNormalBuff: charaBuffList["damageUPOnlyNormalDamageBuff"],
HPBuff: charaBuffList["hpBuff"],
DABuff: charaBuffList["daBuff"],
TABuff: charaBuffList["taBuff"],
Expand Down Expand Up @@ -3201,7 +3212,7 @@ module.exports.generateHaisuiData = function (res, arml, summon, prof, chara, st
var newTotalAttack = summedAttack * newTotalSkillCoeff;
var newTotalExpected = newTotalAttack * onedata[key].criticalRatio * onedata[key].expectedAttack;

var newDamage = module.exports.calcDamage(summedAttack, newTotalSkillCoeff, onedata[key].criticalRatio, prof.enemyDefense, prof.defenseDebuff, onedata[key].skilldata.enemyResistance, onedata[key].skilldata.additionalDamage, onedata[key].skilldata.damageUP, onedata[key].normalDamageLimitValues)
var newDamage = module.exports.calcDamage(summedAttack, newTotalSkillCoeff, onedata[key].criticalRatio, prof.enemyDefense, prof.defenseDebuff, onedata[key].skilldata.enemyResistance, onedata[key].skilldata.additionalDamage, onedata[key].skilldata.damageUP + onedata[key].skilldata.damageUPOnlyNormalDamage, onedata[key].normalDamageLimitValues)
var newOugiDamage = module.exports.calcOugiDamage(summedAttack, newTotalSkillCoeff, onedata[key].criticalRatio, prof.enemyDefense, prof.defenseDebuff, onedata[key].skilldata.enemyResistance, onedata[key].ougiRatio, onedata[key].skilldata.ougiDamageUP, onedata[key].skilldata.damageUP, onedata[key].ougiFixedDamage, onedata[key].ougiBonusPlainDamage, onedata[key].ougiDamageLimitValues)

var chainBurstSupplemental = 0;
Expand Down Expand Up @@ -3465,7 +3476,7 @@ module.exports.generateSimulationData = function (res, turnBuff, arml, summon, p
}
} else {
// Regular attack
var newDamage = module.exports.calcDamage(onedata[key].displayAttack, onedata[key].totalSkillCoeff, onedata[key].criticalRatio, prof.enemyDefense, prof.defenseDebuff, onedata[key].skilldata.enemyResistance, onedata[key].skilldata.additionalDamage, onedata[key].skilldata.damageUP, onedata[key].normalDamageLimitValues);
var newDamage = module.exports.calcDamage(onedata[key].displayAttack, onedata[key].totalSkillCoeff, onedata[key].criticalRatio, prof.enemyDefense, prof.defenseDebuff, onedata[key].skilldata.enemyResistance, onedata[key].skilldata.additionalDamage, onedata[key].skilldata.damageUP + onedata[key].skilldata.damageUPOnlyNormalDamage, onedata[key].normalDamageLimitValues);
if (key == "Djeeta") {
ExpectedDamage[t].push(parseInt(newDamage * onedata[key].expectedAttack));
AverageExpectedDamage[t][j + 1] += parseInt(onedata[key].expectedAttack * newDamage / cnt)
Expand Down
22 changes: 22 additions & 0 deletions src/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ var Profile = CreateClass({
elementBuff: 0,
otherBuff: 0,
otherBuff2: 0,
damageUPOnlyNormalBuff: 0,
additionalDamageBuff: 0,
supplementalDamageBuff: 0,
damageLimitBuff: 0.0,
Expand Down Expand Up @@ -212,6 +213,7 @@ var Profile = CreateClass({
personalElementBuff: 0.0,
personalOtherBuff: 0.0,
personalOtherBuff2: 0.0,
personalDamageUPOnlyNormalBuff: 0.0,
personalAdditionalDamageBuff: 0.0,
personalSupplementalDamageBuff: 0,
personalDABuff: 0.0,
Expand Down Expand Up @@ -500,6 +502,13 @@ var Profile = CreateClass({
onChange={this.handleSelectEvent.bind(this, "personalOugiDamageLimitBuff")}>{selector.buffLevel}</FormControl>
<InputGroup.Addon>%</InputGroup.Addon>
</InputGroup></td>
</tr>,
<tr key="personalDamageUPOnlyNormalBuff">
<th className="bg-primary">{intl.translate("与ダメージUPバフ(通常攻撃のみ)", locale)}</th>
<td><InputGroup><FormControl componentClass="select" value={this.state.personalDamageUPOnlyNormalBuff}
onChange={this.handleSelectEvent.bind(this, "personalDamageUPOnlyNormalBuff")}>{selector.buffLevel}</FormControl>
<InputGroup.Addon>%</InputGroup.Addon>
</InputGroup></td>
</tr>
]
: null}
Expand Down Expand Up @@ -958,6 +967,19 @@ var Profile = CreateClass({
</tr>
</TextWithTooltip>

<TextWithTooltip tooltip={intl.translate("与ダメージUPバフ(通常攻撃のみ)説明", locale)} id={"tooltip-damageuponlynormal-detail"}>
<tr>
<th className="bg-primary">{intl.translate("与ダメージUPバフ(通常攻撃のみ)", locale)}</th>
<td>
<InputGroup>
<FormControl componentClass="select" value={this.state.damageUPOnlyNormalBuff}
onChange={this.handleSelectEvent.bind(this, "damageUPOnlyNormalBuff")}> {selector.buffLevel} </FormControl>
<InputGroup.Addon>%</InputGroup.Addon>
</InputGroup>
</td>
</tr>
</TextWithTooltip>

<tr>
<td colSpan="2">
<strong>{intl.translate("Advanced", locale)}</strong>
Expand Down
5 changes: 3 additions & 2 deletions src/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ var Result = CreateClass({
let damageSupplemental = 0, damageWithoutCriticalSupplemental = 0, ougiDamageSupplemental = 0, chainBurstSupplemental = 0;
[damageSupplemental, damageWithoutCriticalSupplemental, ougiDamageSupplemental, chainBurstSupplemental] = supplemental.calcOthersDamage(m.data[key].skilldata.supplementalDamageArray, [damageSupplemental, damageWithoutCriticalSupplemental, ougiDamageSupplemental, chainBurstSupplemental], {remainHP: m.data[key].remainHP});

let normalDamageRealLimit = createRealLimitValues(m.data[key].normalDamageLimitValues, m.data[key].skilldata.damageUP, m.data[key].skilldata.enemyResistance, 0, 0, damageSupplemental);
let normalDamageRealLimit = createRealLimitValues(m.data[key].normalDamageLimitValues, m.data[key].skilldata.damageUPOnlyNormalDamage, m.data[key].skilldata.enemyResistance, 0, 0, damageSupplemental);
let ougiDamageRealLimit = createRealLimitValues(m.data[key].ougiDamageLimitValues, m.data[key].skilldata.damageUP, m.data[key].skilldata.enemyResistance, m.data[key].ougiFixedDamage, m.data[key].criticalRatio, ougiDamageSupplemental);

charaDetail[key].push(
Expand Down Expand Up @@ -1439,7 +1439,8 @@ var Result = CreateClass({
};
pushSkillInfoElement3("ougiGageBuff", "奥義ゲージ上昇量", "default");
pushSkillInfoElement3("additionalDamage", "追加ダメージ", "default");
pushSkillInfoElement3("damageUP", "与ダメージ上昇", "default");
pushSkillInfoElement3("damageUP", "与ダメージUP", "default");
pushSkillInfoElement3("damageUPOnlyNormalDamage", "与ダメージUP(通常攻撃のみ)", "default");
pushSkillInfoElement3("damageLimit", "ダメージ上限アップ", "default");
pushSkillInfoElement3("ougiDamageLimit", "奥義ダメージ上限アップ", "default");
pushSkillInfoElement3("ougiDamageUP", "奥義ダメージアップ", "default");
Expand Down
21 changes: 18 additions & 3 deletions src/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ var multiLangData = {
"ja": "属性バフ",
"zh": "属性Buff",
},
"与ダメージUPバフ(通常攻撃のみ)": {
"en": "Boost DMG Buff (only one-foe attacks)",
"ja": "与ダメージUPバフ(通常攻撃のみ)",
"zh": "与ダメージUPバフ(通常攻撃のみ)",
},
"与ダメージUPバフ(通常攻撃のみ)説明": {
"en": "DMG and DMG CAP for one-foe attacks are amplified. EX, Kumbhira, Seox 2nd Skill",
"ja": "通常攻撃の最終的なダメージが上昇します。クビラ2アビなど",
"zh": "通常攻撃の最終的なダメージが上昇します。クビラ2アビなど",
},
"属性バフ説明": {
"en": "Element Buff. Ultima Weapon(30%) etc.",
"ja": "属性枠のバフ。オメガ武器(30%)など",
Expand Down Expand Up @@ -372,11 +382,16 @@ var multiLangData = {
"zh": "C.A. DMG Buff",
},

"与ダメージ上昇": {
"en": "Damage UP ",
"ja": "与ダメージ上昇",
"与ダメージUP": {
"en": "Boost DMG",
"ja": "与ダメージUP",
"zh": "造成伤害上升",
},
"与ダメージUP(通常攻撃のみ)": {
"en": "Boost DMG (only one-foe attacks)",
"ja": "与ダメージUP(通常攻撃のみ)",
"zh": "造成伤害上升(通常攻撃)",
},
"個別バフ": {
"en": "Indiv Buff", //a.k.a: Personal buff
"ja": "個別バフ",
Expand Down

0 comments on commit 2c6415e

Please sign in to comment.