mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-09 05:36:05 +08:00
Fix tower mob level and hp scaling (#2430)
This commit is contained in:
parent
1fac319eb2
commit
0bbeaf254b
@ -13,6 +13,7 @@ public class TowerLevelData extends GameResource {
|
|||||||
private int levelGroupId;
|
private int levelGroupId;
|
||||||
private int dungeonId;
|
private int dungeonId;
|
||||||
private List<TowerLevelCond> conds;
|
private List<TowerLevelCond> conds;
|
||||||
|
private int monsterLevel;
|
||||||
|
|
||||||
public static class TowerLevelCond {
|
public static class TowerLevelCond {
|
||||||
private TowerCondType towerCondType;
|
private TowerCondType towerCondType;
|
||||||
|
@ -49,7 +49,6 @@ public final class AbilityManager extends BasePlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Getter private boolean abilityInvulnerable = false;
|
@Getter private boolean abilityInvulnerable = false;
|
||||||
@Getter private Consumer<Integer> clearBurstEnergy;
|
|
||||||
private int burstCasterId;
|
private int burstCasterId;
|
||||||
private int burstSkillId;
|
private int burstSkillId;
|
||||||
|
|
||||||
@ -59,7 +58,6 @@ public final class AbilityManager extends BasePlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removePendingEnergyClear() {
|
public void removePendingEnergyClear() {
|
||||||
this.clearBurstEnergy = null;
|
|
||||||
this.burstCasterId = 0;
|
this.burstCasterId = 0;
|
||||||
this.burstSkillId = 0;
|
this.burstSkillId = 0;
|
||||||
}
|
}
|
||||||
@ -96,15 +94,16 @@ public final class AbilityManager extends BasePlayerManager {
|
|||||||
> 0;
|
> 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.clearBurstEnergy != null
|
if (this.burstCasterId == entityId
|
||||||
&& this.burstCasterId == entityId
|
|
||||||
&& (ability.getAvatarSkillStartIds().contains(this.burstSkillId) || skillInvincibility)) {
|
&& (ability.getAvatarSkillStartIds().contains(this.burstSkillId) || skillInvincibility)) {
|
||||||
Grasscutter.getLogger()
|
Grasscutter.getLogger()
|
||||||
.trace(
|
.trace(
|
||||||
"Caster ID's {} burst successful, clearing energy and setting invulnerability",
|
"Caster ID's {} burst successful, clearing energy and setting invulnerability",
|
||||||
entityId);
|
entityId);
|
||||||
this.abilityInvulnerable = true;
|
this.abilityInvulnerable = true;
|
||||||
this.clearBurstEnergy.accept(entityId);
|
this.player
|
||||||
|
.getEnergyManager()
|
||||||
|
.handleEvtDoSkillSuccNotify(this.player.getSession(), this.burstSkillId, this.burstCasterId);
|
||||||
this.removePendingEnergyClear();
|
this.removePendingEnergyClear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,13 +336,8 @@ public final class AbilityManager extends BasePlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Track this elemental burst to possibly clear avatar energy later.
|
// Track this elemental burst to possibly clear avatar energy later.
|
||||||
this.clearBurstEnergy =
|
|
||||||
(ignored) ->
|
|
||||||
player
|
|
||||||
.getEnergyManager()
|
|
||||||
.handleEvtDoSkillSuccNotify(player.getSession(), skillId, casterId);
|
|
||||||
this.burstCasterId = casterId;
|
|
||||||
this.burstSkillId = skillId;
|
this.burstSkillId = skillId;
|
||||||
|
this.burstCasterId = casterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,9 +82,14 @@ public final class DungeonManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getLevelForMonster(int id) {
|
public int getLevelForMonster(int id) {
|
||||||
|
if (isTowerDungeon()) {
|
||||||
|
// Tower dungeons have their own level setting in TowerLevelData
|
||||||
|
return scene.getPlayers().get(0).getTowerManager().getCurrentMonsterLevel();
|
||||||
|
} else {
|
||||||
// TODO should use levelConfigMap? and how?
|
// TODO should use levelConfigMap? and how?
|
||||||
return dungeonData.getShowLevel();
|
return dungeonData.getShowLevel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean activateRespawnPoint(int pointId) {
|
public boolean activateRespawnPoint(int pointId) {
|
||||||
val respawnPoint = GameData.getScenePointEntryById(scene.getId(), pointId);
|
val respawnPoint = GameData.getScenePointEntryById(scene.getId(), pointId);
|
||||||
|
@ -355,6 +355,28 @@ public class EntityMonster extends GameEntity {
|
|||||||
+ (this.getFightProperty(c.getBase())
|
+ (this.getFightProperty(c.getBase())
|
||||||
* (1f + this.getFightProperty(c.getPercent())))));
|
* (1f + this.getFightProperty(c.getPercent())))));
|
||||||
|
|
||||||
|
// If in tower, scale max hp by
|
||||||
|
// +50%: Floors 3 – 7
|
||||||
|
// +100%: Floors 8 – 11
|
||||||
|
// +150%: Floor 12
|
||||||
|
var dungeonManager = getScene().getDungeonManager();
|
||||||
|
var towerManager = getScene().getPlayers().get(0).getTowerManager();
|
||||||
|
if (dungeonManager != null && dungeonManager.isTowerDungeon() && towerManager != null) {
|
||||||
|
var floor = towerManager.getCurrentFloorNumber();
|
||||||
|
float additionalScaleFactor = 0f;
|
||||||
|
if (floor >= 12) {
|
||||||
|
additionalScaleFactor = 1.5f;
|
||||||
|
} else if (floor >= 8) {
|
||||||
|
additionalScaleFactor = 1.f;
|
||||||
|
} else if (floor >= 3) {
|
||||||
|
additionalScaleFactor = .5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setFightProperty(
|
||||||
|
FightProperty.FIGHT_PROP_MAX_HP,
|
||||||
|
this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * (1 + additionalScaleFactor));
|
||||||
|
}
|
||||||
|
|
||||||
// Set current hp
|
// Set current hp
|
||||||
this.setFightProperty(
|
this.setFightProperty(
|
||||||
FightProperty.FIGHT_PROP_CUR_HP,
|
FightProperty.FIGHT_PROP_CUR_HP,
|
||||||
|
@ -29,6 +29,11 @@ public class TowerManager extends BasePlayerManager {
|
|||||||
return this.getTowerData().currentFloorId;
|
return this.getTowerData().currentFloorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** floor number: 1 - 12 **/
|
||||||
|
public int getCurrentFloorNumber() {
|
||||||
|
return GameData.getTowerFloorDataMap().get(getCurrentFloorId()).getFloorIndex();
|
||||||
|
}
|
||||||
|
|
||||||
public int getCurrentLevelId() {
|
public int getCurrentLevelId() {
|
||||||
return this.getTowerData().currentLevelId + this.getTowerData().currentLevel;
|
return this.getTowerData().currentLevelId + this.getTowerData().currentLevel;
|
||||||
}
|
}
|
||||||
@ -93,8 +98,17 @@ public class TowerManager extends BasePlayerManager {
|
|||||||
player.getTeamManager().setupTemporaryTeam(towerTeams);
|
player.getTeamManager().setupTemporaryTeam(towerTeams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TowerLevelData getCurrentTowerLevelDataMap() {
|
||||||
|
return GameData.getTowerLevelDataMap().get(getCurrentLevelId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentMonsterLevel() {
|
||||||
|
// monsterLevel given in TowerLevelExcelConfigData.json is off by one.
|
||||||
|
return getCurrentTowerLevelDataMap().getMonsterLevel() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
public void enterLevel(int enterPointId) {
|
public void enterLevel(int enterPointId) {
|
||||||
var levelData = GameData.getTowerLevelDataMap().get(getCurrentLevelId());
|
var levelData = getCurrentTowerLevelDataMap();
|
||||||
|
|
||||||
var dungeonId = levelData.getDungeonId();
|
var dungeonId = levelData.getDungeonId();
|
||||||
|
|
||||||
@ -140,7 +154,7 @@ public class TowerManager extends BasePlayerManager {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var levelData = GameData.getTowerLevelDataMap().get(getCurrentLevelId());
|
var levelData = getCurrentTowerLevelDataMap();
|
||||||
// 0-based indexing. "star" = 0 means checking for 1-star conditions.
|
// 0-based indexing. "star" = 0 means checking for 1-star conditions.
|
||||||
int star;
|
int star;
|
||||||
for (star = 2; star >= 0; star--) {
|
for (star = 2; star >= 0; star--) {
|
||||||
|
@ -767,6 +767,20 @@ public class Scene {
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLevelForMonster(int configId, int defaultLevel) {
|
||||||
|
if (getDungeonManager() != null) {
|
||||||
|
return getDungeonManager().getLevelForMonster(configId);
|
||||||
|
} else if (getWorld().getWorldLevel() > 0) {
|
||||||
|
var worldLevelData =
|
||||||
|
GameData.getWorldLevelDataMap().get(getWorld().getWorldLevel());
|
||||||
|
|
||||||
|
if (worldLevelData != null) {
|
||||||
|
return worldLevelData.getMonsterLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultLevel;
|
||||||
|
}
|
||||||
|
|
||||||
public void checkNpcGroup() {
|
public void checkNpcGroup() {
|
||||||
Set<SceneNpcBornEntry> npcBornEntries = ConcurrentHashMap.newKeySet();
|
Set<SceneNpcBornEntry> npcBornEntries = ConcurrentHashMap.newKeySet();
|
||||||
for (Player player : this.getPlayers()) {
|
for (Player player : this.getPlayers()) {
|
||||||
|
@ -1069,18 +1069,7 @@ public class SceneScriptManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate level
|
// Calculate level
|
||||||
int level = monster.level;
|
int level = getScene().getLevelForMonster(monster.config_id, monster.level);
|
||||||
|
|
||||||
if (getScene().getDungeonManager() != null) {
|
|
||||||
level = getScene().getDungeonManager().getLevelForMonster(monster.config_id);
|
|
||||||
} else if (getScene().getWorld().getWorldLevel() > 0) {
|
|
||||||
var worldLevelData =
|
|
||||||
GameData.getWorldLevelDataMap().get(getScene().getWorld().getWorldLevel());
|
|
||||||
|
|
||||||
if (worldLevelData != null) {
|
|
||||||
level = worldLevelData.getMonsterLevel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Spawn mob
|
// Spawn mob
|
||||||
EntityMonster entity = new EntityMonster(getScene(), data, monster.pos, monster.rot, level);
|
EntityMonster entity = new EntityMonster(getScene(), data, monster.pos, monster.rot, level);
|
||||||
|
Loading…
Reference in New Issue
Block a user