Skip to content

Commit

Permalink
[qa] fix fighter followers (attack/defence) not being comparable
Browse files Browse the repository at this point in the history
  • Loading branch information
nroutasuo committed Aug 7, 2022
1 parent 795eff8 commit bc3428b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/game/components/player/FollowersComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function (Ash, FollowerVO, FollowerConstants, ItemConstants) {
let type = FollowerConstants.getFollowerTypeForAbilityType(follower.abilityType);
let selectedFollower = this.getFollowerInPartyByType(type);
if (selectedFollower == null) return 1;
if (selectedFollower.abilityType != follower.abilityType) return 0;
if (!FollowerConstants.isComparableAbilityTypes(selectedFollower.abilityType, follower.abilityType)) return 0;

return FollowerConstants.getTotalItemBonus(follower) - FollowerConstants.getTotalItemBonus(selectedFollower);
},
Expand Down
10 changes: 10 additions & 0 deletions src/game/constants/FollowerConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@ define(['ash',
return abilityType == FollowerConstants.abilityType.SCAVENGE_CAPACITY;
},

isComparableAbilityTypes: function (a, b) {
if (a == b) return true;

let isFighter = function (t) { return t == FollowerConstants.abilityType.ATTACK || t == FollowerConstants.abilityType.DEFENCE; }

if (isFighter(a) && isFighter(b)) return true;

return false;
},

getPronoun: function (follower) {
if (this.isAnimal(follower.abilityType)) return "it";
if (follower.gender == CultureConstants.genders.FEMALE) return "she";
Expand Down

0 comments on commit bc3428b

Please sign in to comment.