You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Lorenzooone and myself have rewritten a couple sections of code to be better, but an architecture change would be ideal.
Right now there are a lot of places in the codebase where code is copy/pasted and does exactly the same thing, but against a different property.
One of my slightly better implementations is to iterate over a list of properties to check, so we only needed to write the actual logic once. This is not super efficient, though. Ideally, we don't need to "check all the hero properties for subproperties", but have a hash map of properties associated with the hero that we can check instantly.
Here's an example of something that will spawn more copy pasta if move type effectiveness is added for passives:
// super effectiveness against movement types
if (attacker.weaponData.hasOwnProperty("move_effective") && defender.moveType.includes(attacker.weaponData.move_effective)) {
if (defender.passiveAData.hasOwnProperty("cancel_effective")) {
battleInfo.logMsg += "Effectiveness against " + defender.moveType + " neutralized by opponent [" + skillInfo['a'][defender.passiveA].name + "]. ";
} else {
atkPower = roundNum(atkPower * 1.5, false);
battleInfo.logMsg += "Effectiveness against " + defender.moveType + " boosts attack by 50% [" + weaponInfo[attacker.weaponName].name + "]. ";
}
}
As you can see, the logic specifically checks the weapon data of the hero for this section of the combat logic. I propose a mapping of properties currently affecting a hero such that we don't need to check weapon data, check passiveA data, check passiveC data etc etc.
The text was updated successfully, but these errors were encountered:
No sweat @Lorenzooone, you've been a big help so far regardless. I won't be able to do much until this weekend, and I'll likely be focused on integrating everyone's changes and testing on KageroChart. Possibly a banner update.
@Lorenzooone and myself have rewritten a couple sections of code to be better, but an architecture change would be ideal.
Right now there are a lot of places in the codebase where code is copy/pasted and does exactly the same thing, but against a different property.
One of my slightly better implementations is to iterate over a list of properties to check, so we only needed to write the actual logic once. This is not super efficient, though. Ideally, we don't need to "check all the hero properties for subproperties", but have a hash map of properties associated with the hero that we can check instantly.
Here's an example of something that will spawn more copy pasta if move type effectiveness is added for passives:
As you can see, the logic specifically checks the weapon data of the hero for this section of the combat logic. I propose a mapping of properties currently affecting a hero such that we don't need to check weapon data, check passiveA data, check passiveC data etc etc.
The text was updated successfully, but these errors were encountered: