Skills already have a method to check if they are hero skills.

This commit is contained in:
MobiusDevelopment
2021-05-16 12:25:59 +00:00
parent b513e66c88
commit 8177e3f123
6 changed files with 22 additions and 48 deletions

View File

@@ -16,10 +16,6 @@
*/
package org.l2jmobius.gameserver.data;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.model.Skill;
/**
@@ -27,23 +23,17 @@ import org.l2jmobius.gameserver.model.Skill;
*/
public class HeroSkillTable
{
private static final Map<Integer, Skill> HERO_SKILLS = new HashMap<>();
static
private static final Skill[] HERO_SKILLS = new Skill[]
{
HERO_SKILLS.put(395, SkillTable.getInstance().getSkill(395, 1));
HERO_SKILLS.put(396, SkillTable.getInstance().getSkill(396, 1));
HERO_SKILLS.put(1374, SkillTable.getInstance().getSkill(1374, 1));
HERO_SKILLS.put(1375, SkillTable.getInstance().getSkill(1375, 1));
HERO_SKILLS.put(1376, SkillTable.getInstance().getSkill(1376, 1));
}
SkillTable.getInstance().getSkill(395, 1),
SkillTable.getInstance().getSkill(396, 1),
SkillTable.getInstance().getSkill(1374, 1),
SkillTable.getInstance().getSkill(1375, 1),
SkillTable.getInstance().getSkill(1376, 1)
};
public static Collection<Skill> getHeroSkills()
public static Skill[] getHeroSkills()
{
return HERO_SKILLS.values();
}
public static boolean isHeroSkill(int skillId)
{
return HERO_SKILLS.containsKey(skillId);
return HERO_SKILLS;
}
}

View File

@@ -25,7 +25,6 @@ import java.util.StringTokenizer;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.HeroSkillTable;
import org.l2jmobius.gameserver.data.SkillTable;
import org.l2jmobius.gameserver.data.sql.SkillTreeTable;
import org.l2jmobius.gameserver.enums.ClassId;
@@ -581,8 +580,7 @@ public abstract class Skill
{
_chanceCondition = ChanceCondition.parse(set);
}
_isHeroSkill = HeroSkillTable.isHeroSkill(_id);
_isHeroSkill = (_id == 395) || (_id == 396) || (_id == 1374) || (_id == 1375) || (_id == 1376); // TODO: Move to XML?
_baseCritRate = set.getInt("baseCritRate", (_skillType == SkillType.PDAM) || (_skillType == SkillType.BLOW) ? 0 : -1);
_lethalEffect1 = set.getInt("lethal1", 0);
_lethalEffect2 = set.getInt("lethal2", 0);

View File

@@ -36,7 +36,6 @@ import org.l2jmobius.gameserver.ai.AttackableAI;
import org.l2jmobius.gameserver.ai.CreatureAI;
import org.l2jmobius.gameserver.ai.CtrlEvent;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.data.HeroSkillTable;
import org.l2jmobius.gameserver.data.SkillTable;
import org.l2jmobius.gameserver.data.sql.NpcTable;
import org.l2jmobius.gameserver.data.xml.MapRegionData;
@@ -7579,7 +7578,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
return true;
}
if (activeChar.isHero() && HeroSkillTable.isHeroSkill(skill.getId()) && activeChar.isInOlympiadMode() && activeChar.isOlympiadStart())
if (activeChar.isHero() && skill.isHeroSkill() && activeChar.isInOlympiadMode() && activeChar.isOlympiadStart())
{
activeChar.sendMessage("You can't use Hero skills during Olympiad match.");
return true;