Fix MoC cycle counter

This commit is contained in:
Melledy
2024-05-09 05:25:01 -07:00
parent 6c5c7d8801
commit f1d3ece247
5 changed files with 244 additions and 256 deletions

View File

@@ -19,7 +19,12 @@ public final class ChallengeInfoOuterClass {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 score = 2;</code>
* <code>optional uint32 round_count = 2;</code>
*/
private int roundCount;
/**
* <code>optional uint32 score = 3;</code>
*/
private int score;
@@ -28,11 +33,6 @@ public final class ChallengeInfoOuterClass {
*/
private int scoreTwo;
/**
* <code>optional uint32 round_count = 13;</code>
*/
private int roundCount;
/**
* <code>optional uint32 challenge_id = 14;</code>
*/
@@ -64,25 +64,62 @@ public final class ChallengeInfoOuterClass {
}
/**
* <code>optional uint32 score = 2;</code>
* @return whether the score field is set
* <code>optional uint32 round_count = 2;</code>
* @return whether the roundCount field is set
*/
public boolean hasScore() {
public boolean hasRoundCount() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 score = 2;</code>
* <code>optional uint32 round_count = 2;</code>
* @return this
*/
public ChallengeInfo clearRoundCount() {
bitField0_ &= ~0x00000001;
roundCount = 0;
return this;
}
/**
* <code>optional uint32 round_count = 2;</code>
* @return the roundCount
*/
public int getRoundCount() {
return roundCount;
}
/**
* <code>optional uint32 round_count = 2;</code>
* @param value the roundCount to set
* @return this
*/
public ChallengeInfo setRoundCount(final int value) {
bitField0_ |= 0x00000001;
roundCount = value;
return this;
}
/**
* <code>optional uint32 score = 3;</code>
* @return whether the score field is set
*/
public boolean hasScore() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 score = 3;</code>
* @return this
*/
public ChallengeInfo clearScore() {
bitField0_ &= ~0x00000001;
bitField0_ &= ~0x00000002;
score = 0;
return this;
}
/**
* <code>optional uint32 score = 2;</code>
* <code>optional uint32 score = 3;</code>
* @return the score
*/
public int getScore() {
@@ -90,12 +127,12 @@ public final class ChallengeInfoOuterClass {
}
/**
* <code>optional uint32 score = 2;</code>
* <code>optional uint32 score = 3;</code>
* @param value the score to set
* @return this
*/
public ChallengeInfo setScore(final int value) {
bitField0_ |= 0x00000001;
bitField0_ |= 0x00000002;
score = value;
return this;
}
@@ -105,7 +142,7 @@ public final class ChallengeInfoOuterClass {
* @return whether the scoreTwo field is set
*/
public boolean hasScoreTwo() {
return (bitField0_ & 0x00000002) != 0;
return (bitField0_ & 0x00000004) != 0;
}
/**
@@ -113,7 +150,7 @@ public final class ChallengeInfoOuterClass {
* @return this
*/
public ChallengeInfo clearScoreTwo() {
bitField0_ &= ~0x00000002;
bitField0_ &= ~0x00000004;
scoreTwo = 0;
return this;
}
@@ -132,45 +169,8 @@ public final class ChallengeInfoOuterClass {
* @return this
*/
public ChallengeInfo setScoreTwo(final int value) {
bitField0_ |= 0x00000002;
scoreTwo = value;
return this;
}
/**
* <code>optional uint32 round_count = 13;</code>
* @return whether the roundCount field is set
*/
public boolean hasRoundCount() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 round_count = 13;</code>
* @return this
*/
public ChallengeInfo clearRoundCount() {
bitField0_ &= ~0x00000004;
roundCount = 0;
return this;
}
/**
* <code>optional uint32 round_count = 13;</code>
* @return the roundCount
*/
public int getRoundCount() {
return roundCount;
}
/**
* <code>optional uint32 round_count = 13;</code>
* @param value the roundCount to set
* @return this
*/
public ChallengeInfo setRoundCount(final int value) {
bitField0_ |= 0x00000004;
roundCount = value;
scoreTwo = value;
return this;
}
@@ -397,9 +397,9 @@ public final class ChallengeInfoOuterClass {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
roundCount = other.roundCount;
score = other.score;
scoreTwo = other.scoreTwo;
roundCount = other.roundCount;
challengeId = other.challengeId;
status = other.status;
extraLineupType = other.extraLineupType;
@@ -414,15 +414,15 @@ public final class ChallengeInfoOuterClass {
return this;
}
cachedSize = -1;
if (other.hasRoundCount()) {
setRoundCount(other.roundCount);
}
if (other.hasScore()) {
setScore(other.score);
}
if (other.hasScoreTwo()) {
setScoreTwo(other.scoreTwo);
}
if (other.hasRoundCount()) {
setRoundCount(other.roundCount);
}
if (other.hasChallengeId()) {
setChallengeId(other.challengeId);
}
@@ -445,9 +445,9 @@ public final class ChallengeInfoOuterClass {
}
cachedSize = -1;
bitField0_ = 0;
roundCount = 0;
score = 0;
scoreTwo = 0;
roundCount = 0;
challengeId = 0;
status = 0;
extraLineupType = 0;
@@ -476,9 +476,9 @@ public final class ChallengeInfoOuterClass {
}
ChallengeInfo other = (ChallengeInfo) o;
return bitField0_ == other.bitField0_
&& (!hasRoundCount() || roundCount == other.roundCount)
&& (!hasScore() || score == other.score)
&& (!hasScoreTwo() || scoreTwo == other.scoreTwo)
&& (!hasRoundCount() || roundCount == other.roundCount)
&& (!hasChallengeId() || challengeId == other.challengeId)
&& (!hasStatus() || status == other.status)
&& (!hasExtraLineupType() || extraLineupType == other.extraLineupType)
@@ -489,15 +489,15 @@ public final class ChallengeInfoOuterClass {
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 16);
output.writeUInt32NoTag(score);
output.writeUInt32NoTag(roundCount);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 32);
output.writeUInt32NoTag(scoreTwo);
output.writeRawByte((byte) 24);
output.writeUInt32NoTag(score);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 104);
output.writeUInt32NoTag(roundCount);
output.writeRawByte((byte) 32);
output.writeUInt32NoTag(scoreTwo);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 112);
@@ -521,13 +521,13 @@ public final class ChallengeInfoOuterClass {
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(score);
size += 1 + ProtoSink.computeUInt32SizeNoTag(roundCount);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(scoreTwo);
size += 1 + ProtoSink.computeUInt32SizeNoTag(score);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(roundCount);
size += 1 + ProtoSink.computeUInt32SizeNoTag(scoreTwo);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeId);
@@ -552,9 +552,18 @@ public final class ChallengeInfoOuterClass {
while (true) {
switch (tag) {
case 16: {
// roundCount
roundCount = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 24) {
break;
}
}
case 24: {
// score
score = input.readUInt32();
bitField0_ |= 0x00000001;
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 32) {
break;
@@ -563,15 +572,6 @@ public final class ChallengeInfoOuterClass {
case 32: {
// scoreTwo
scoreTwo = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 104) {
break;
}
}
case 104: {
// roundCount
roundCount = input.readUInt32();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 112) {
@@ -638,13 +638,13 @@ public final class ChallengeInfoOuterClass {
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.score, score);
output.writeUInt32(FieldNames.roundCount, roundCount);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.scoreTwo, scoreTwo);
output.writeUInt32(FieldNames.score, score);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeUInt32(FieldNames.roundCount, roundCount);
output.writeUInt32(FieldNames.scoreTwo, scoreTwo);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeUInt32(FieldNames.challengeId, challengeId);
@@ -668,11 +668,23 @@ public final class ChallengeInfoOuterClass {
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case -171935711:
case -244677858: {
if (input.isAtField(FieldNames.roundCount)) {
if (!input.trySkipNullValue()) {
roundCount = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 109264530: {
if (input.isAtField(FieldNames.score)) {
if (!input.trySkipNullValue()) {
score = input.readUInt32();
bitField0_ |= 0x00000001;
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
@@ -684,18 +696,6 @@ public final class ChallengeInfoOuterClass {
if (input.isAtField(FieldNames.scoreTwo)) {
if (!input.trySkipNullValue()) {
scoreTwo = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -171935711:
case -244677858: {
if (input.isAtField(FieldNames.roundCount)) {
if (!input.trySkipNullValue()) {
roundCount = input.readUInt32();
bitField0_ |= 0x00000004;
}
} else {
@@ -812,12 +812,12 @@ public final class ChallengeInfoOuterClass {
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName roundCount = FieldName.forField("roundCount", "round_count");
static final FieldName score = FieldName.forField("score");
static final FieldName scoreTwo = FieldName.forField("scoreTwo", "score_two");
static final FieldName roundCount = FieldName.forField("roundCount", "round_count");
static final FieldName challengeId = FieldName.forField("challengeId", "challenge_id");
static final FieldName status = FieldName.forField("status");

View File

@@ -25,10 +25,6 @@ public final class GetFriendLoginInfoScRspOuterClass {
private int retcode;
/**
* <pre>
* ?
* </pre>
*
* <code>repeated uint32 friend_uid_list = 7;</code>
*/
private final RepeatedInt friendUidList = RepeatedInt.newEmptyInstance();
@@ -81,10 +77,6 @@ public final class GetFriendLoginInfoScRspOuterClass {
}
/**
* <pre>
* ?
* </pre>
*
* <code>repeated uint32 friend_uid_list = 7;</code>
* @return whether the friendUidList field is set
*/
@@ -93,10 +85,6 @@ public final class GetFriendLoginInfoScRspOuterClass {
}
/**
* <pre>
* ?
* </pre>
*
* <code>repeated uint32 friend_uid_list = 7;</code>
* @return this
*/
@@ -107,10 +95,6 @@ public final class GetFriendLoginInfoScRspOuterClass {
}
/**
* <pre>
* ?
* </pre>
*
* <code>repeated uint32 friend_uid_list = 7;</code>
*
* This method returns the internal storage object without modifying any has state.
@@ -125,10 +109,6 @@ public final class GetFriendLoginInfoScRspOuterClass {
}
/**
* <pre>
* ?
* </pre>
*
* <code>repeated uint32 friend_uid_list = 7;</code>
*
* This method returns the internal storage object and sets the corresponding
@@ -143,10 +123,6 @@ public final class GetFriendLoginInfoScRspOuterClass {
}
/**
* <pre>
* ?
* </pre>
*
* <code>repeated uint32 friend_uid_list = 7;</code>
* @param value the friendUidList to add
* @return this
@@ -158,10 +134,6 @@ public final class GetFriendLoginInfoScRspOuterClass {
}
/**
* <pre>
* ?
* </pre>
*
* <code>repeated uint32 friend_uid_list = 7;</code>
* @param values the friendUidList to add
* @return this

View File

@@ -23,18 +23,18 @@ public final class StartChallengeStoryBuffInfoOuterClass {
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 8;</code>
* <code>optional uint32 story_buff_two = 8;</code>
*/
private int storyBuffOne;
private int storyBuffTwo;
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_two = 9;</code>
* <code>optional uint32 story_buff_one = 9;</code>
*/
private int storyBuffTwo;
private int storyBuffOne;
private StartChallengeStoryBuffInfo() {
}
@@ -51,10 +51,10 @@ public final class StartChallengeStoryBuffInfoOuterClass {
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 8;</code>
* @return whether the storyBuffOne field is set
* <code>optional uint32 story_buff_two = 8;</code>
* @return whether the storyBuffTwo field is set
*/
public boolean hasStoryBuffOne() {
public boolean hasStoryBuffTwo() {
return (bitField0_ & 0x00000001) != 0;
}
@@ -63,64 +63,11 @@ public final class StartChallengeStoryBuffInfoOuterClass {
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 8;</code>
* @return this
*/
public StartChallengeStoryBuffInfo clearStoryBuffOne() {
bitField0_ &= ~0x00000001;
storyBuffOne = 0;
return this;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 8;</code>
* @return the storyBuffOne
*/
public int getStoryBuffOne() {
return storyBuffOne;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 8;</code>
* @param value the storyBuffOne to set
* @return this
*/
public StartChallengeStoryBuffInfo setStoryBuffOne(final int value) {
bitField0_ |= 0x00000001;
storyBuffOne = value;
return this;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_two = 9;</code>
* @return whether the storyBuffTwo field is set
*/
public boolean hasStoryBuffTwo() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_two = 9;</code>
* <code>optional uint32 story_buff_two = 8;</code>
* @return this
*/
public StartChallengeStoryBuffInfo clearStoryBuffTwo() {
bitField0_ &= ~0x00000002;
bitField0_ &= ~0x00000001;
storyBuffTwo = 0;
return this;
}
@@ -130,7 +77,7 @@ public final class StartChallengeStoryBuffInfoOuterClass {
* ?
* </pre>
*
* <code>optional uint32 story_buff_two = 9;</code>
* <code>optional uint32 story_buff_two = 8;</code>
* @return the storyBuffTwo
*/
public int getStoryBuffTwo() {
@@ -142,23 +89,76 @@ public final class StartChallengeStoryBuffInfoOuterClass {
* ?
* </pre>
*
* <code>optional uint32 story_buff_two = 9;</code>
* <code>optional uint32 story_buff_two = 8;</code>
* @param value the storyBuffTwo to set
* @return this
*/
public StartChallengeStoryBuffInfo setStoryBuffTwo(final int value) {
bitField0_ |= 0x00000002;
bitField0_ |= 0x00000001;
storyBuffTwo = value;
return this;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 9;</code>
* @return whether the storyBuffOne field is set
*/
public boolean hasStoryBuffOne() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 9;</code>
* @return this
*/
public StartChallengeStoryBuffInfo clearStoryBuffOne() {
bitField0_ &= ~0x00000002;
storyBuffOne = 0;
return this;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 9;</code>
* @return the storyBuffOne
*/
public int getStoryBuffOne() {
return storyBuffOne;
}
/**
* <pre>
* ?
* </pre>
*
* <code>optional uint32 story_buff_one = 9;</code>
* @param value the storyBuffOne to set
* @return this
*/
public StartChallengeStoryBuffInfo setStoryBuffOne(final int value) {
bitField0_ |= 0x00000002;
storyBuffOne = value;
return this;
}
@Override
public StartChallengeStoryBuffInfo copyFrom(final StartChallengeStoryBuffInfo other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
storyBuffOne = other.storyBuffOne;
storyBuffTwo = other.storyBuffTwo;
storyBuffOne = other.storyBuffOne;
}
return this;
}
@@ -169,12 +169,12 @@ public final class StartChallengeStoryBuffInfoOuterClass {
return this;
}
cachedSize = -1;
if (other.hasStoryBuffOne()) {
setStoryBuffOne(other.storyBuffOne);
}
if (other.hasStoryBuffTwo()) {
setStoryBuffTwo(other.storyBuffTwo);
}
if (other.hasStoryBuffOne()) {
setStoryBuffOne(other.storyBuffOne);
}
return this;
}
@@ -185,8 +185,8 @@ public final class StartChallengeStoryBuffInfoOuterClass {
}
cachedSize = -1;
bitField0_ = 0;
storyBuffOne = 0;
storyBuffTwo = 0;
storyBuffOne = 0;
return this;
}
@@ -210,19 +210,19 @@ public final class StartChallengeStoryBuffInfoOuterClass {
}
StartChallengeStoryBuffInfo other = (StartChallengeStoryBuffInfo) o;
return bitField0_ == other.bitField0_
&& (!hasStoryBuffOne() || storyBuffOne == other.storyBuffOne)
&& (!hasStoryBuffTwo() || storyBuffTwo == other.storyBuffTwo);
&& (!hasStoryBuffTwo() || storyBuffTwo == other.storyBuffTwo)
&& (!hasStoryBuffOne() || storyBuffOne == other.storyBuffOne);
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 64);
output.writeUInt32NoTag(storyBuffOne);
output.writeUInt32NoTag(storyBuffTwo);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 72);
output.writeUInt32NoTag(storyBuffTwo);
output.writeUInt32NoTag(storyBuffOne);
}
}
@@ -230,10 +230,10 @@ public final class StartChallengeStoryBuffInfoOuterClass {
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(storyBuffOne);
size += 1 + ProtoSink.computeUInt32SizeNoTag(storyBuffTwo);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(storyBuffTwo);
size += 1 + ProtoSink.computeUInt32SizeNoTag(storyBuffOne);
}
return size;
}
@@ -246,8 +246,8 @@ public final class StartChallengeStoryBuffInfoOuterClass {
while (true) {
switch (tag) {
case 64: {
// storyBuffOne
storyBuffOne = input.readUInt32();
// storyBuffTwo
storyBuffTwo = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 72) {
@@ -255,8 +255,8 @@ public final class StartChallengeStoryBuffInfoOuterClass {
}
}
case 72: {
// storyBuffTwo
storyBuffTwo = input.readUInt32();
// storyBuffOne
storyBuffOne = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 0) {
@@ -281,10 +281,10 @@ public final class StartChallengeStoryBuffInfoOuterClass {
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.storyBuffOne, storyBuffOne);
output.writeUInt32(FieldNames.storyBuffTwo, storyBuffTwo);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.storyBuffTwo, storyBuffTwo);
output.writeUInt32(FieldNames.storyBuffOne, storyBuffOne);
}
output.endObject();
}
@@ -296,11 +296,11 @@ public final class StartChallengeStoryBuffInfoOuterClass {
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 1761423966:
case 1329547396: {
if (input.isAtField(FieldNames.storyBuffOne)) {
case 1761429060:
case 1329552490: {
if (input.isAtField(FieldNames.storyBuffTwo)) {
if (!input.trySkipNullValue()) {
storyBuffOne = input.readUInt32();
storyBuffTwo = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
@@ -308,11 +308,11 @@ public final class StartChallengeStoryBuffInfoOuterClass {
}
break;
}
case 1761429060:
case 1329552490: {
if (input.isAtField(FieldNames.storyBuffTwo)) {
case 1761423966:
case 1329547396: {
if (input.isAtField(FieldNames.storyBuffOne)) {
if (!input.trySkipNullValue()) {
storyBuffTwo = input.readUInt32();
storyBuffOne = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
@@ -374,9 +374,9 @@ public final class StartChallengeStoryBuffInfoOuterClass {
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName storyBuffOne = FieldName.forField("storyBuffOne", "story_buff_one");
static final FieldName storyBuffTwo = FieldName.forField("storyBuffTwo", "story_buff_two");
static final FieldName storyBuffOne = FieldName.forField("storyBuffOne", "story_buff_one");
}
}
}

View File

@@ -139,47 +139,47 @@ public class ChallengeInstance {
// Handle result
switch (result) {
case BATTLE_END_WIN:
// Check if any avatar in the lineup has died
battle.getLineup().forEachAvatar(avatar -> {
if (avatar.getCurrentHp(battle.getLineup()) <= 0) {
hasAvatarDied = true;
case BATTLE_END_WIN:
// Check if any avatar in the lineup has died
battle.getLineup().forEachAvatar(avatar -> {
if (avatar.getCurrentHp(battle.getLineup()) <= 0) {
hasAvatarDied = true;
}
});
// Get monster count in stage
long monsters = player.getScene().getEntities().values().stream().filter(e -> e instanceof EntityMonster).count();
if (monsters == 0) {
this.advanceStage();
}
});
// Get monster count in stage
long monsters = player.getScene().getEntities().values().stream().filter(e -> e instanceof EntityMonster).count();
if (monsters == 0) {
this.advanceStage();
}
// Calculate rounds left
if (!this.isStory()) {
this.roundsLeft = Math.min(Math.max(this.roundsLeft - stats.getRoundCnt(), 1), this.roundsLeft);
}
// Set saved technique points (This will be restored if the player resets the challenge)
this.savedMp = player.getCurrentLineup().getMp();
break;
case BATTLE_END_QUIT:
// Reset technique points and move back to start position
var lineup = player.getCurrentLineup();
lineup.setMp(this.savedMp);
player.moveTo(this.getStartPos(), this.getStartRot());
player.sendPacket(new PacketSyncLineupNotify(lineup));
break;
default:
// Determine challenge result
if (this.isStory() && stats.getEndReason() == BattleEndReason.BATTLE_END_REASON_TURN_LIMIT) {
this.advanceStage();
} else {
// Fail challenge
this.setStatus(ChallengeStatus.CHALLENGE_FAILED);
// Send challenge result data
player.sendPacket(new PacketChallengeSettleNotify(this));
}
break;
// Calculate rounds left
if (!this.isStory()) {
this.roundsLeft = Math.min(Math.max(this.roundsLeft - stats.getRoundCnt(), 1), this.roundsLeft);
}
// Set saved technique points (This will be restored if the player resets the challenge)
this.savedMp = player.getCurrentLineup().getMp();
break;
case BATTLE_END_QUIT:
// Reset technique points and move back to start position
var lineup = player.getCurrentLineup();
lineup.setMp(this.savedMp);
player.moveTo(this.getStartPos(), this.getStartRot());
player.sendPacket(new PacketSyncLineupNotify(lineup));
break;
default:
// Determine challenge result
if (this.isStory() && stats.getEndReason() == BattleEndReason.BATTLE_END_REASON_TURN_LIMIT) {
this.advanceStage();
} else {
// Fail challenge
this.setStatus(ChallengeStatus.CHALLENGE_FAILED);
// Send challenge result data
player.sendPacket(new PacketChallengeSettleNotify(this));
}
break;
}
}

View File

@@ -0,0 +1,16 @@
package emu.lunarcore.server.packet.recv;
import emu.lunarcore.server.game.GameSession;
import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.server.packet.Opcodes;
import emu.lunarcore.server.packet.PacketHandler;
@Opcodes(CmdId.GetFriendChallengeLineupCsReq)
public class HandlerGetFriendChallengeLineupCsReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] data) throws Exception {
session.send(CmdId.GetFriendChallengeLineupScRsp);
}
}