Store replaced skills and skip learning them.

Thanks to marciox25.
This commit is contained in:
MobiusDevelopment
2022-06-07 12:51:51 +00:00
parent a0dd0d82d1
commit 8f34090a81
36 changed files with 311 additions and 0 deletions

View File

@@ -718,6 +718,11 @@ public class SkillTreeData implements IXmlReader
continue;
}
if (player.hasReplacedSkill(skill.getSkillId()))
{
continue;
}
if (player.getLevel() >= skill.getGetLevel())
{
if (skill.getSkillLevel() > SkillData.getInstance().getMaxLevel(skill.getSkillId()))
@@ -1521,6 +1526,11 @@ public class SkillTreeData implements IXmlReader
continue;
}
if (player.hasReplacedSkill(skill.getSkillId()))
{
continue;
}
if (minLevelForNewSkill <= skill.getGetLevel())
{
final Skill oldSkill = player.getKnownSkill(skill.getSkillId());

View File

@@ -838,6 +838,7 @@ public class Player extends Playable
/** Map containing all custom skills of this player. */
private Map<Integer, Skill> _customSkills = null;
public final Set<Integer> _replacedSkills = ConcurrentHashMap.newKeySet(1);
private volatile int _actionMask;
@@ -13485,6 +13486,21 @@ public class Player extends Playable
}
}
public void addReplacedSkill(int skillId)
{
_replacedSkills.add(skillId);
}
public void removeReplacedSkill(int skillId)
{
_replacedSkills.remove(skillId);
}
public boolean hasReplacedSkill(int skillId)
{
return _replacedSkills.contains(skillId);
}
/**
* @return {@code true} if current player can revive and shows 'To Village' button upon death, {@code false} otherwise.
*/