Skip to content

Commit

Permalink
Changed priority order; fixed chain skills with priority
Browse files Browse the repository at this point in the history
- Priority order is now reversed, following a more natural approach (higher priority = higher number).
- Chain skills are now sorted by priority if there is any is given. Otherwise, they are still shuffled.
  • Loading branch information
Estrayl committed May 30, 2024
1 parent 5ad3d4c commit f90e536
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
</npc_skills>
<!-- Grand Commander Pashid -->
<npc_skills npc_ids="231130">
<npc_skill id="21236" lv="6" prob="100" prio="1" min_time="120000" cd="600000" next_skill_time="6500" /><!-- Exultation -->
<npc_skill id="21236" lv="6" prob="100" prio="3" min_time="120000" cd="600000" next_skill_time="6500" /><!-- Exultation -->
<npc_skill id="20777" lv="5" prob="100" prio="2" min_time="180000" cd="600000" next_skill_time="6500" /><!-- Triumphant Roar -->
<npc_skill id="21237" lv="1" prob="100" prio="3" min_time="240000" cd="60000" next_skill_time="6500" /><!-- Trooper Shock -->
<npc_skill id="21237" lv="1" prob="100" prio="1" min_time="240000" cd="60000" next_skill_time="6500" /><!-- Trooper Shock -->
<npc_skill id="21234" lv="56" prob="100" next_chain_id="1" next_skill_time="6500" /><!-- Corruption Breath -->
<npc_skill id="21231" lv="1" prob="100" chain_id="1" next_chain_id="2" next_skill_time="7000" /><!-- Acid Bomb -->
<npc_skill id="21231" lv="1" prob="100" chain_id="2" next_chain_id="3" next_skill_time="7000" /><!-- Acid Bomb -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<npc_skill id="21248" lv="56" prob="60" min_hp="15" max_hp="45" cd="30000" />
<npc_skill id="21249" lv="56" prob="50" max_hp="10" cd="140000" target="RANDOM_EXCEPT_MOST_HATED"/>
<npc_skill id="21249" lv="56" prob="60" max_hp="10" cd="30000"/>
<npc_skill id="21250" lv="56" prob="70" min_hp="30" max_hp="75" chain_id="0" next_chain_id="1" next_skill_time="0" cd="55000" prio="1"/>
<npc_skill id="21250" lv="56" prob="70" min_hp="30" max_hp="75" chain_id="0" next_chain_id="1" next_skill_time="0" cd="55000" prio="2"/>
<npc_skill id="21251" lv="56" prob="100" chain_id="1" />
<npc_skill id="21250" lv="56" prob="70" max_hp="25" chain_id="0" next_chain_id="4" next_skill_time="0" cd="55000" prio="2"/>
<npc_skill id="21250" lv="56" prob="70" max_hp="25" chain_id="0" next_chain_id="4" next_skill_time="0" cd="55000" prio="1"/>
<npc_skill id="21252" lv="56" prob="100" chain_id="4"/>
</npc_skills>
<!-- Ide Forcefield Generator -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<npc_skill id="21552" lv="56" prob="100" /><!-- Onslaught -->
<npc_skill id="21553" lv="56" prob="100" cd="14000" /><!-- Cleaving Massacre -->
<npc_skill id="21554" lv="56" prob="100" cd="8000" /><!-- Butcher's Sweep -->
<npc_skill id="21555" lv="56" prob="100" cd="40000" prio="2" next_chain_id="1" next_skill_time="3000" min_time="60000" /><!-- Aerial Confinement -->
<npc_skill id="21555" lv="56" prob="100" cd="40000" prio="1" next_chain_id="1" next_skill_time="3000" min_time="60000" /><!-- Aerial Confinement -->
<npc_skill id="21556" lv="56" prob="100" chain_id="1" />
<npc_skill id="21558" lv="56" prob="100" cd="60000" prio="1" min_time="30000" /><!-- Aether Prison -->
<npc_skill id="21558" lv="56" prob="100" cd="60000" prio="2" min_time="30000" /><!-- Aether Prison -->
</npc_skills>
<npc_skills npc_ids="702300 702301">
<npc_skill id="21420" lv="65" prob="100" next_skill_time="0" /><!-- Wide Area Bombardment -->
Expand Down
12 changes: 6 additions & 6 deletions game-server/data/static_data/npc_skills/npc_skills.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21194,14 +21194,14 @@
<npc_skill id="16673" lv="41" prob="25" />
<npc_skill id="17468" lv="41" prob="25" />
<npc_skill id="18168" lv="41" prob="25" />
<npc_skill id="18170" lv="41" prob="100" prio="1" max_hp="25" cd="180000" />
<npc_skill id="18170" lv="41" prob="100" prio="3" max_hp="25" cd="180000" />
<npc_skill id="18171" lv="41" prob="25" />
<npc_skill id="18227" lv="41" prob="25" />
<npc_skill id="18228" lv="41" prob="25" />
<npc_skill id="18238" lv="41" prob="100" prio="2" min_hp="60" max_hp="80" next_chain_id="1" next_skill_time="5000" cd="120000">
<spawn_npc npc_id="281245" min_count="4" min_distance="2" max_distance="5" />
</npc_skill>
<npc_skill id="18238" lv="41" prob="100" prio="3" max_hp="30" next_chain_id="1" next_skill_time="5000" cd="40000">
<npc_skill id="18238" lv="41" prob="100" prio="1" max_hp="30" next_chain_id="1" next_skill_time="5000" cd="40000">
<spawn_npc npc_id="281245" min_count="2" min_distance="2" max_distance="5" />
</npc_skill>
<npc_skill id="18215" lv="1" prob="0" chain_id="1" />
Expand Down Expand Up @@ -23750,16 +23750,16 @@
</npc_skills>
<npc_skills npc_ids="215280">
<npc_skill id="18225" lv="41" prob="40" cd="10000" />
<npc_skill id="18217" lv="50" prob="100" min_hp="80" prio="1" next_chain_id="1" next_skill_time="5000" cd="30000" />
<npc_skill id="18217" lv="50" prob="100" min_hp="80" prio="4" next_chain_id="1" next_skill_time="5000" cd="30000" />
<npc_skill id="18229" lv="50" prob="100" chain_id="1" next_chain_id="2" next_skill_time="4000" />
<npc_skill id="18225" lv="50" prob="100" chain_id="2" />
<npc_skill id="18232" lv="50" prob="100" min_hp="60" max_hp="80" prio="2" next_chain_id="3" next_skill_time="5000" cd="30000" />
<npc_skill id="18232" lv="50" prob="100" min_hp="60" max_hp="80" prio="3" next_chain_id="3" next_skill_time="5000" cd="30000" />
<npc_skill id="18225" lv="50" prob="100" chain_id="3" next_chain_id="4" next_skill_time="4000" />
<npc_skill id="18231" lv="50" prob="100" chain_id="4" />
<npc_skill id="18236" lv="50" prob="100" min_hp="30" max_hp="60" prio="3" next_chain_id="5" next_skill_time="5000" cd="30000" />
<npc_skill id="18236" lv="50" prob="100" min_hp="30" max_hp="60" prio="2" next_chain_id="5" next_skill_time="5000" cd="30000" />
<npc_skill id="18232" lv="50" prob="100" chain_id="5" next_chain_id="6" next_skill_time="4000" />
<npc_skill id="18225" lv="50" prob="100" chain_id="6" />
<npc_skill id="18239" lv="50" prob="100" max_hp="30" prio="4" next_chain_id="7" next_skill_time="4000" cd="60000" />
<npc_skill id="18239" lv="50" prob="100" max_hp="30" prio="1" next_chain_id="7" next_skill_time="4000" cd="60000" />
<npc_skill id="18243" lv="50" prob="100" chain_id="7" next_chain_id="8" next_skill_time="3000" />
<npc_skill id="18243" lv="50" prob="100" chain_id="8" next_chain_id="9" next_skill_time="9000" />
<npc_skill id="18232" lv="50" prob="100" chain_id="9" next_chain_id="10" next_skill_time="10500" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<npc_skill_templates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="npc_skills.xsd">
<!-- Sematariux -->
<npc_skills npc_ids="216520">
<npc_skill id="18722" lv="1" prob="100" cd="120000" min_time="30000" prio="1" /><!-- Primal Fear -->
<npc_skill id="18722" lv="1" prob="100" cd="120000" min_time="30000" prio="2" /><!-- Primal Fear -->
<npc_skill id="18728" lv="1" prob="70" /><!-- Destructive Bite -->
<npc_skill id="18729" lv="1" prob="70" next_chain_id="1" next_skill_time="4000" /><!-- Destructive Claw -->
<npc_skill id="18725" lv="1" prob="100" chain_id="1" /><!-- Brandish Tail -->
<npc_skill id="18723" lv="1" prob="70" cd="26000" max_hp="80" /><!-- Lightning Breath -->
<npc_skill id="19178" lv="1" prob="70" cd="32000" max_hp="70" /><!-- Deadly Bolt -->
<npc_skill id="19182" lv="1" prob="100" cd="210000" max_hp="60" prio="2" /><!-- Ear Piercing Shriek -->
<npc_skill id="19182" lv="1" prob="100" cd="210000" max_hp="60" prio="1" /><!-- Ear Piercing Shriek -->
<npc_skill id="18724" lv="1" prob="70" cd="26000" max_hp="50" /><!-- Poisonous Breath -->
<npc_skill id="19184" lv="1" prob="70" cd="18000" max_hp="30" /><!-- Thundering Crash -->
</npc_skills>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<npc_skill_templates xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="npc_skills.xsd">
<npc_skills npc_ids="216580">
<npc_skill id="18722" lv="1" prob="100" min_time="30000" cd="120000" prio="1" /><!-- Primal Fear -->
<npc_skill id="20100" lv="1" prob="100" min_time="180000" cd="64000" prio="2" /><!-- Padmarashka' Roar -->
<npc_skill id="18722" lv="1" prob="100" min_time="30000" cd="120000" prio="2" /><!-- Primal Fear -->
<npc_skill id="20100" lv="1" prob="100" min_time="180000" cd="64000" prio="1" /><!-- Padmarashka' Roar -->
<npc_skill id="20093" lv="6" prob="70" cd="26000" /><!-- Destructive Claw -->
<npc_skill id="20401" lv="6" prob="70" cd="26000" /><!-- Venomous Claw -->
<npc_skill id="20098" lv="8" prob="60" max_hp="80" cd="15000" /><!-- Brandish Tail -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,13 @@ public static NpcSkillEntry chooseNextSkill(NpcAI npcAI) {
NpcSkillEntry lastSkill = owner.getGameStats().getLastSkill();
if (lastSkill != null && lastSkill.hasChain() && lastSkill.canUseNextChain(owner)) {
List<NpcSkillEntry> chainSkills = skillList.getChainSkills(lastSkill);
if (chainSkills.size() > 1)
Collections.shuffle(chainSkills);
if (chainSkills.size() > 1) {
if (chainSkills.stream().anyMatch(cs -> cs.getPriority() > 0)) {
chainSkills.sort(Comparator.comparingInt(NpcSkillEntry::getPriority).reversed());
} else {
Collections.shuffle(chainSkills);
}
}
for (NpcSkillEntry entry : chainSkills) {
if (entry != null && isReady(owner, entry)) {
return getNpcSkillEntryIfNotTooFarAway(owner, entry);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.aionemu.gameserver.model.skill;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.*;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -48,7 +45,7 @@ private void initSkillList(int npcId) {
prios.add(template.getPriority());
}
}
prios.sort(null);
prios.sort(Comparator.reverseOrder());
priorities = prios.stream().mapToInt(Integer::intValue).toArray();
}
}
Expand All @@ -73,7 +70,7 @@ public NpcSkillEntry getSkillOnPosition(int position) {
public List<NpcSkillEntry> getPostSpawnSkills() {
List<NpcSkillEntry> filteredSkills = new ArrayList<>();
for (NpcSkillEntry skill : skills)
if (((NpcSkillTemplateEntry) skill).hasPostSpawnCondition())
if (skill.hasPostSpawnCondition())
filteredSkills.add(skill);
return filteredSkills;
}
Expand Down

0 comments on commit f90e536

Please sign in to comment.