Fix level capped party members not gaining friendship

pull/449/head
Flashfyre 2024-05-04 00:19:50 -04:00
parent b529eee5ac
commit 5b4f1da854
1 changed files with 6 additions and 3 deletions

View File

@ -3220,19 +3220,22 @@ export class VictoryPhase extends PokemonPhase {
const expShareModifier = this.scene.findModifier(m => m instanceof ExpShareModifier) as ExpShareModifier; const expShareModifier = this.scene.findModifier(m => m instanceof ExpShareModifier) as ExpShareModifier;
const expBalanceModifier = this.scene.findModifier(m => m instanceof ExpBalanceModifier) as ExpBalanceModifier; const expBalanceModifier = this.scene.findModifier(m => m instanceof ExpBalanceModifier) as ExpBalanceModifier;
const multipleParticipantExpBonusModifier = this.scene.findModifier(m => m instanceof MultipleParticipantExpBonusModifier) as MultipleParticipantExpBonusModifier; const multipleParticipantExpBonusModifier = this.scene.findModifier(m => m instanceof MultipleParticipantExpBonusModifier) as MultipleParticipantExpBonusModifier;
const expPartyMembers = party.filter(p => p.hp && p.level < this.scene.getMaxExpLevel()); const nonFaintedPartyMembers = party.filter(p => p.hp);
const expPartyMembers = nonFaintedPartyMembers.filter(p => p.level < this.scene.getMaxExpLevel());
const partyMemberExp = []; const partyMemberExp = [];
if (participantIds.size) { if (participantIds.size) {
let expValue = this.getPokemon().getExpValue(); let expValue = this.getPokemon().getExpValue();
if (this.scene.currentBattle.battleType === BattleType.TRAINER) if (this.scene.currentBattle.battleType === BattleType.TRAINER)
expValue = Math.floor(expValue * 1.5); expValue = Math.floor(expValue * 1.5);
for (let partyMember of expPartyMembers) { for (let partyMember of nonFaintedPartyMembers) {
const pId = partyMember.id; const pId = partyMember.id;
const participated = participantIds.has(pId); const participated = participantIds.has(pId);
if (participated) if (participated)
partyMember.addFriendship(2); partyMember.addFriendship(2);
else if (!expShareModifier) { if (!expPartyMembers.includes(partyMember))
continue;
if (!participated && !expShareModifier) {
partyMemberExp.push(0); partyMemberExp.push(0);
continue; continue;
} }