Skip to content

Commit

Permalink
IntervalTurn initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
SharpnelXu committed Aug 22, 2024
1 parent 882cdd3 commit 6711afb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion lib/app/battle/models/buff.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@ class BattleBuff {
}
}

void turnPassParamAdd() {
void selfTurnPass() {
for (final buff in validBuffs) {
buff.turnPassParamAdd();
}

for (final buff in getAllBuffs()) {
if (buff.intervalTurn > 0) {
buff.intervalTurn -= 1;
}
}
}

void clearPassive(final int uniqueId) {
Expand Down Expand Up @@ -122,6 +128,7 @@ class BuffData {
int additionalParam = 0;
NiceTd? tdTypeChange;
List<int>? shortenMaxCountEachSkill;
int intervalTurn = -1;

bool checkBuffClear() => count == 0 || logicTurn == 0;

Expand Down Expand Up @@ -336,6 +343,10 @@ class BuffData {
}
}
}

if (vals.IntervalTurn != null) {
intervalTurn = vals.IntervalTurn!;
}
}

void useOnce() {
Expand Down Expand Up @@ -421,6 +432,8 @@ class BuffData {
isAct &= hpRatio <= buff.script.HP_LOWER!;
}

isAct &= intervalTurn <= 0;

if (isAct) {
offState(BuffState.noAct);
} else {
Expand Down Expand Up @@ -476,6 +489,7 @@ class BuffData {
..additionalParam = additionalParam
..tdTypeChange = tdTypeChange
..shortenMaxCountEachSkill = shortenMaxCountEachSkill?.toList()
..intervalTurn = intervalTurn
..actorUniqueId = actorUniqueId
..actorName = actorName
..isUsed = isUsed
Expand Down
2 changes: 1 addition & 1 deletion lib/app/battle/models/svt_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@ class BattleServantData {
await activateBuff(battleData, BuffAction.functionSelfturnend);
await activateDelayFunction(battleData, delayedFunctions.where((buff) => buff.logicTurn == 0));

battleBuff.turnPassParamAdd();
battleBuff.selfTurnPass();

battleData.checkActorStatus();
}
Expand Down
14 changes: 14 additions & 0 deletions lib/app/modules/battle/simulation/svt_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,20 @@ class BattleBuffIcon extends StatelessWidget {
if (!buff.checkAct()) {
child = Opacity(opacity: 0.5, child: child);
}
if (buff.intervalTurn > 0) {
child = Stack(
alignment: Alignment.center,
children: [
child,
Container(
width: size,
height: size,
color: Colors.black54,
),
Text('${buff.intervalTurn}T', style: TextStyle(fontSize: size * 0.8, color: Colors.white)),
],
);
}
return child;
}
}
Expand Down

0 comments on commit 6711afb

Please sign in to comment.