Skip to content

Commit

Permalink
Puts in new Lyn... The new bows are hell. (#101)
Browse files Browse the repository at this point in the history
* Puts in new Lyn... The new bows are hell.

* Fix Laws of Sacae's effect and improve bonds message
  • Loading branch information
Lorenzooone authored and winsomniak committed Jun 4, 2018
1 parent 69916ae commit 14ee760
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 12 deletions.
1 change: 1 addition & 0 deletions public/data/heroes/kaze-easygoing-ninja.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"weapon_type": "Dagger",
"link": "https://kagerochart.com/hero/kaze-easygoing-ninja",
"move_type": "Infantry",
"LowestRarity":3,
"weapon": [
"barb-shuriken-plus",
"barb-shuriken",
Expand Down
51 changes: 51 additions & 0 deletions public/data/heroes/lyn-lady-of-the-wind.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"display": "Lyn, Lady of the Wind",
"name": "Lyn",
"title": "Lady of the Wind",
"id": "lyn-lady-of-the-wind",
"color": "Green",
"weapon_type": "Green Bow",
"legendary":true,
"link": "https://kagerochart.com/hero/lyn-lady-of-the-wind",
"move_type": "Infantry",
"weapon": [
"swift-mulagir",
"silver-bow",
"steel-bow",
"iron-bow"
],
"assist": [
"rally-defense-resistance",
"rally-defense"
],
"passive_a": [
"laws-of-sacae"
],
"passive_b": [
"desperation-3",
"desperation-2",
"desperation-1"
],
"passive_c": [
"spd-tactic-3",
"spd-tactic-2",
"spd-tactic-1"
],
"base_stat": {
"star_5": {
"hp": 17,
"atk": 9,
"spd": 10,
"def": 4,
"res": 5
},
"growth": {
"hp": 5,
"atk": 6,
"spd": 8,
"def": 4,
"res": 6,
"total": 29
}
}
}
21 changes: 21 additions & 0 deletions public/data/passives/a/laws-of-sacae.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Laws of Sacae",
"sp": 300,
"type": "A",
"description": "If foe initiates combat and the number of allies within 2 spaces ≥ 2, grants Atk/Spd/Def/Res+4 during combat.",
"icon": "/images/icons/passives/laws-of-sacae.png",
"link": "https://kagerochart.com/hero/passives/laws-of-sacae",
"adjacent_stat_bonus": {
"target": "self",
"adjacent": "ally",
"en_phase":true,
"needed": 2,
"mod": {
"atk": 4,
"spd": 4,
"def": 4,
"res": 4
}
},
"id": "laws-of-sacae"
}
9 changes: 9 additions & 0 deletions public/data/passives/c/spd-tactic-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Spd Tactic 1",
"sp": 60,
"type": "C",
"description": "At start of turn, grants Spd+2 to allies within 2 spaces for 1 turn. Granted only if number of that ally's movement type on current team ≤ 2.",
"icon": "/images/icons/passives/spd-tactic-1.png",
"link": "https://kagerochart.com/hero/passives/spd-tactic-1",
"id": "spd-tactic-1"
}
9 changes: 9 additions & 0 deletions public/data/passives/c/spd-tactic-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Spd Tactic 2",
"sp": 120,
"type": "C",
"description": "At start of turn, grants Spd+4 to allies within 2 spaces for 1 turn. Granted only if number of that ally's movement type on current team ≤ 2.",
"icon": "/images/icons/passives/spd-tactic-2.png",
"link": "https://kagerochart.com/hero/passives/spd-tactic-2",
"id": "spd-tactic-2"
}
9 changes: 9 additions & 0 deletions public/data/passives/c/spd-tactic-3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Spd Tactic 3",
"sp": 240,
"type": "C",
"description": "At start of turn, grants Spd+6 to allies within 2 spaces for 1 turn. Granted only if number of that ally's movement type on current team ≤ 2.",
"icon": "/images/icons/passives/spd-tactic-3.png",
"link": "https://kagerochart.com/hero/passives/spd-tactic-3",
"id": "spd-tactic-3"
}
26 changes: 26 additions & 0 deletions public/data/weapons/swift-mulagir.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Swift Mulagir",
"might": 14,
"range": 2,
"sp": 400,
"description": "Effective against flying foes. Grants Res+3. If the number of allies within 2 spaces (excluding unit) > the number of foes within 2 spaces (excluding target), grants Atk/Spd+5 during combat.",
"type": "Bow",
"link": "https://kagerochart.com/hero/weapons/swift-mulagir",
"magical": false,
"stat_mod": {
"res": 3
},
"adjacent_stat_bonus": {
"target": "self",
"adjacent": "ally",
"mod": {
"atk": 5,
"spd": 5
}
},
"move_effective": [
"Flying"
],
"char_unique": true,
"id": "swift-mulagir"
}
16 changes: 8 additions & 8 deletions public/scripts/combat-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ function canPreventEnemyCounter(container, hp, currHP) {


//Checks the follows (Brash, Riposte, follow-up, fighters & breakers) and if the agent has wary fighter or sweep ability
function Follow(char, attacker, othWeapon, CanCounter, battleInfo) {
function Follow(char, attacker, othWeapon, othColor, CanCounter, battleInfo) {
var doubling=1;
for (var i = 0; i < checks.length; i++) {
var bfup=char[checks[i]].attack_follow_up;
if(!attacker)
bfup=char[checks[i]].defense_follow_up;
if (bfup) {
if ((!bfup.hasOwnProperty("threshold")) || (bfup.trigger==='healthy' && char.initHP >= roundNum(bfup.threshold * char.hp, true)) || (bfup.trigger==='damaged' && char.initHP <= roundNum(bfup.threshold * char.hp, true))) { //hp check for all of them
if((!bfup.hasOwnProperty("weapon_type")) || (bfup.weapon_type.includes(othWeapon))){ //breaker check
if((!bfup.hasOwnProperty("weapon_type")) || (bfup.weapon_type.includes(othWeapon) && (othWeapon !== 'Bow' || othColor === 'Colorless'))){ //breaker check
if((!bfup.hasOwnProperty("counterable")) || (CanCounter)) { //brash check
if((!bfup.hasOwnProperty("adjacent_dependant")) || char.adjacent == 0) {
doubling++;
Expand Down Expand Up @@ -274,7 +274,7 @@ function Prevent(char, agent, ageWeapon, battleInfo, attacker)
//healthy (Breakers and Wary fighter) and stat_to_check (Myrrh)
if ((!prev.hasOwnProperty("stat_to_check")) || (ReturnStat(char, prev.stat_to_check) >= ReturnStat(agent, prev.stat_to_check)+ prev.stat_amount)) {
if((!prev.hasOwnProperty("threshold")) || char.initHP >= roundNum(prev.threshold * char.hp, true)) {
if((!prev.hasOwnProperty("weapon_type")) || (prev.weapon_type.includes(ageWeapon))){
if((!prev.hasOwnProperty("weapon_type")) || (prev.weapon_type.includes(ageWeapon) && (ageWeapon !== 'Bow' || agent.color === 'Colorless'))){
prevention+=1;
battleInfo.logMsg+= "<li class='battle-interaction'><span class='" + char.agentClass + "'>" + char.display + "</span>'s " + char[checks[i]].name + " activated, decreasing <span class='" + agent.agentClass + "'>" + agent.display +"</span>'s ability to follow-up!</li>";
}
Expand Down Expand Up @@ -339,21 +339,21 @@ function firstDmgReduction(char, enemy) {
}

//Bonus for adjacency to allies
function adjacentStatBonus(battleInfo, char, charToUse) {
function adjacentStatBonus(battleInfo, char, charToUse, initiator) {
checks.forEach(function(key) {
var bonus = char[key].adjacent_stat_bonus
if (!bonus) {
return;
}

if (char.adjacent < 1) {
if (char.adjacent < 1 || (bonus.hasOwnProperty("needed") && bonus.needed > char.adjacent) || (bonus.hasOwnProperty("en_phase") && initiator)) {
return;
}

if (bonus.target === 'self' && bonus.adjacent === 'ally') {
for (b in bonus.mod) {
battleInfo[charToUse][b] += bonus.mod[b];
battleInfo.logMsg += "<li class='battle-interaction'><span class='" + charToUse + "'><strong>" + battleInfo[charToUse].display + "</strong></span> raises " + b + " by " + bonus.mod[b] + "</li>";
battleInfo.logMsg += "<li class='battle-interaction'><span class='" + charToUse + "'>" + battleInfo[charToUse].display + "</span> raises " + b + " by " + bonus.mod[b] + " [" + char[key].name + "].</li>";
};
}
})
Expand Down Expand Up @@ -415,7 +415,7 @@ function hardy_bearing_msg(battleInfo, agent) {
}

//This is redundant, separating this makes it easier to maintain
function giveBonuses(battleInfo, agent, other){
function giveBonuses(battleInfo, agent, other, initiator){

// below hp threshold bonus
if (agent.weaponData.hasOwnProperty("below_threshold_mod") && agent.initHP <= checkRoundError(agent.weaponData.below_threshold_mod.threshold * agent.hp)) {
Expand Down Expand Up @@ -458,7 +458,7 @@ function giveBonuses(battleInfo, agent, other){
}

//adjacent stat bonus
adjacentStatBonus(battleInfo, agent, agent.agentClass);
battleInfo=adjacentStatBonus(battleInfo, agent, agent.agentClass, initiator);

return battleInfo;
}
Expand Down
11 changes: 7 additions & 4 deletions public/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ function isInheritableWeapon(weapon, charName) {
if (weaponType.indexOf("Breath") !== -1) {
weaponType = "Breath";
}
if (weaponType.indexOf("Bow") !== -1) {
weaponType = "Bow";
}

return !weapon.char_unique && weapon.type === weaponType;
}
Expand Down Expand Up @@ -1901,20 +1904,20 @@ function simBattle(battleInfo, displayMsg) {
// ATTACKER BONUSES
battleInfo= checkMods(battleInfo, attacker, defender, "initiate_mod", "attacker", "by initiating combat", " against");

battleInfo = giveBonuses(battleInfo, attacker, defender);
battleInfo = giveBonuses(battleInfo, attacker, defender, true);

//DEFENDER BONUSES
battleInfo= checkMods(battleInfo, defender, attacker, "defend_mod", "defender", "by getting attacked", " by");

battleInfo = giveBonuses(battleInfo, defender, attacker);
battleInfo = giveBonuses(battleInfo, defender, attacker, false);

// can defender counter
var defCC = defCanCounter(battleInfo);
var defAttacks = false;

//New follow-up logic
battleInfo = Follow(attacker, true, defender.weaponData.type, defCC, battleInfo);
battleInfo = Follow(defender, false, attacker.weaponData.type, true, battleInfo);
battleInfo = Follow(attacker, true, defender.weaponData.type, defender.color, defCC, battleInfo);
battleInfo = Follow(defender, false, attacker.weaponData.type, attacker.color, true, battleInfo);

battleInfo = Prevent(attacker, defender, defender.weaponData.type, battleInfo, true);
battleInfo = Prevent(defender, attacker, attacker.weaponData.type, battleInfo, false);
Expand Down

0 comments on commit 14ee760

Please sign in to comment.