Skip to content

Commit

Permalink
fix: final
Browse files Browse the repository at this point in the history
  • Loading branch information
T13MAX committed Oct 24, 2024
1 parent 4d772f8 commit 73ab021
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ public void onCreate() {
if (templateBuff == null) {
throw new BattleException("buff不存在, id=" + buffId);
}
List<Integer> effect = templateBuff.effect;
List<String> params = templateBuff.params;
List<String> activeConditions = templateBuff.activeCondition;
List<String> disposedConditions = templateBuff.disposedCondition;
List<Integer> effect = templateBuff.effect;
List<String> params = templateBuff.params;
List<String> activeConditions = templateBuff.activeCondition;
List<String> disposedConditions = templateBuff.disposedCondition;

for (int i = 0; i < effect.size(); i++) {
int effectId = effect.get(i);
Expand Down Expand Up @@ -176,14 +176,17 @@ private void switchBuffStatus(BuffStatus nextStatus, RemoveReason removeReason)
Log.battle.info("switchBuffStatus, pre={}, now={}, removeReason={}", prevStatus, nextStatus, removeReason);

switch (nextStatus) {
case ACTIVE:
case ACTIVE -> {
// 盒子激活
fightContext.getFightEventBus().postEvent(new BuffSwitchToActiveEvent(this));
break;
case DISPOSED:
}
case DISPOSED -> {
fightContext.getFightMatch().getFightHero(this.ownerId).getBuffManager().removeBuff(this.id, removeReason);
this.onDestroy(removeReason);
break;
}
default -> {
Log.battle.info("switchBuffStatus, 状态异常, pre={}, nextStatus={}, removeReason={}", prevStatus, nextStatus, removeReason);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Map;

/**
* 玩家buff管理类
* 英雄buff管理器
*
* @author: t13max
* @since: 15:27 2024/4/10
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.t13max.fight.buff.effect.element;

import com.t13max.fight.impact.ImpactEnum;
import lombok.Getter;

import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
import java.util.Collection;

/**
* 战斗"时光机"
*
* @author: t13max
* @since: 11:34 2024/4/11
*/
public class FightTimeMachine {

private TriggerTimeline triggerTimeline;
private final TriggerTimeline triggerTimeline;

@Getter
private FightContext fightContext;
private final FightContext fightContext;

public FightTimeMachine(FightContext fightContext) {
this.fightContext = fightContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
public class AbstractEvent implements IFightEvent {

private FightEventEnum eventEnum;
private final FightEventEnum eventEnum;

public AbstractEvent(FightEventEnum eventEnum) {
this.eventEnum = eventEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Getter
public class BuffUpdateEvent extends AbstractEvent implements IFightEventPackager {

private IBuffBox buffBox;
private final IBuffBox buffBox;

public BuffUpdateEvent(IBuffBox buffBox) {
super(FightEventEnum.BUFF_UPDATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
import com.t13max.fight.context.FightContext;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
* 战斗事件总线
*
* @author: t13max
* @since: 16:49 2024/4/15
*/
public class FightEventBus {

private FightContext fightContext;
private final FightContext fightContext;

private final Map<FightEventEnum, LinkedList<IFightEventListener>> listenersMap = new ConcurrentHashMap<>();

public FightEventBus(FightContext fightContext) {
this.fightContext = fightContext;
}

private Map<FightEventEnum, LinkedList<IFightEventListener>> listenersMap = new HashMap<>();

public void register(List<IFightEventListener> eventListenerList) {
for (IFightEventListener eventListener : eventListenerList) {
register(eventListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@Getter
public class UnitDeadEvent extends AbstractEvent {

private List<Long> deadList;
private final List<Long> deadList;

public UnitDeadEvent(List<Long> deadList) {
super(FightEventEnum.UNIT_DEAD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class LifecycleObserver implements IFightEventListener {

private static final Set<FightEventEnum> INTEREST_EVENT;

private FightHero fightHero;
private final FightHero fightHero;

static {
Set<FightEventEnum> interests = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import java.util.*;

/**
* 时间线
*
* @author: t13max
* @since: 17:00 2024/4/15
*/
public class TriggerTimeline {

private Map<Integer, LinkedList<ITrigger>> triggerListMap = new HashMap<>();
private final Map<Integer, LinkedList<ITrigger>> triggerListMap = new HashMap<>();

public boolean hasTriggerRemains() {
return !triggerListMap.isEmpty();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.t13max.social;
/**
*
* @Author t13max
* @Date 15:58 2024/10/15
*/

0 comments on commit 73ab021

Please sign in to comment.