Skip to content

Commit

Permalink
Improve gainNpIndividualSum
Browse files Browse the repository at this point in the history
  • Loading branch information
narumi147 committed Aug 19, 2024
1 parent 870ebba commit a581790
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
9 changes: 5 additions & 4 deletions lib/app/battle/functions/gain_np.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ class GainNP {
final targetType = dataVals.Value2 ?? 0;
if (targetType == 0) {
countTargets.add(target);
}
if (targetType == 1 || targetType == 3) {
} else if (targetType == 1) {
countTargets.addAll(aliveAllies);
} else if (targetType == 2) {
countTargets.addAll(aliveEnemies);
} else if (targetType == 3) {
countTargets.addAll(aliveAllies);
}
if (targetType == 2 || targetType == 3) {
countTargets.addAll(aliveEnemies);
}

Expand Down
24 changes: 20 additions & 4 deletions lib/app/descriptors/func/func.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1055,9 +1055,12 @@ class FuncDescriptor extends StatelessWidget {
}
}

_addParamAddTrait(() => Transl.special.funcTraitPerBuff(isSelf: true), vals?.ParamAddSelfIndividuality);
_addParamAddTrait(() => Transl.special.funcTraitPerBuff(isOpp: true), vals?.ParamAddOpIndividuality);
_addParamAddTrait(() => Transl.special.funcTraitPerBuff(isSelf: true), vals?.ParamAddFieldIndividuality);
_addParamAddTrait(
() => Transl.special.funcTraitPerBuff(target: Transl.special.self), vals?.ParamAddSelfIndividuality);
_addParamAddTrait(
() => Transl.special.funcTraitPerBuff(target: Transl.special.opposite), vals?.ParamAddOpIndividuality);
_addParamAddTrait(
() => Transl.special.funcTraitPerBuff(target: Transl.special.field), vals?.ParamAddFieldIndividuality);

List<List<InlineSpan>> _condSpans = [];
void _addTraits(String? prefix, List<NiceTrait> traits, {bool useAnd = false}) {
Expand All @@ -1081,9 +1084,22 @@ class FuncDescriptor extends StatelessWidget {
if (func.traitVals.isNotEmpty) {
if (func.funcType == FuncType.subState) {
_addTraits(Transl.special.funcTraitRemoval, func.traitVals);
} else if (func.funcType == FuncType.gainNpBuffIndividualSum || func.funcType == FuncType.gainNpIndividualSum) {
} else if (func.funcType == FuncType.gainNpBuffIndividualSum) {
spans.addAll(SharedBuilder.replaceSpan(Transl.special.funcTraitPerBuff(), '{0}',
SharedBuilder.traitSpans(context: context, traits: func.traitVals)));
} else if (func.funcType == FuncType.gainNpIndividualSum) {
spans.addAll(SharedBuilder.replaceSpan(
Transl.special.funcTraitPerBuff(
target: {
0: Transl.special.target,
1: Transl.funcTargetType(FuncTargetType.ptAll).l,
2: Transl.funcTargetType(FuncTargetType.enemyAll).l,
3: '${Transl.funcTargetType(FuncTargetType.ptAll).l} & ${Transl.funcTargetType(FuncTargetType.enemyAll).l}',
}[vals?.Value2] ??
'<TargetType${vals?.Value2}>',
),
'{0}',
SharedBuilder.traitSpans(context: context, traits: func.traitVals)));
} else if (func.funcType == FuncType.eventDropUp) {
_addTraits(Transl.special.buffCheckSelf, func.traitVals);
}
Expand Down
16 changes: 2 additions & 14 deletions lib/models/gamedata/mappings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -793,20 +793,7 @@ class _SpecialTransl {
na: 'Remove: ',
kr: '해제: ',
);
String funcTraitPerBuff({
// only one of them can be true
bool isSelf = false,
bool isOpp = false,
bool isField = false,
}) {
String? target;
if (isSelf) {
target = self;
} else if (isOpp) {
target = opposite;
} else if (isField) {
target = field;
}
String funcTraitPerBuff({String? target}) {
return M.of(
jp: '【${target ?? ""}〔{0}〕状態の数によって】',
cn: '【根据${target ?? ""}〔{0}〕状态的数量】',
Expand All @@ -819,6 +806,7 @@ class _SpecialTransl {
String get self => M.of(jp: '自身', cn: '自身', tw: '自身', na: 'self', kr: '자신');
String get opposite => M.of(jp: '対象', cn: '对方', tw: '對方', na: 'opposite', kr: '대상');
String get field => M.of(jp: 'フィールド', cn: '场地', tw: '場地', na: 'Field', kr: null);
String get target => M.of(jp: '対象', cn: '对象', tw: '對象', na: 'Target', kr: null);

String get funcTraitOnField => M.of(
jp: '〔{0}〕のあるフィールドにおいてのみ',
Expand Down

0 comments on commit a581790

Please sign in to comment.