Need help fix skills

asdfycacaa

Путник
Пользователь
Сообщения
10
Розыгрыши
0
Репутация
1
Реакции
1
Баллы
0
Хроники
  1. Prelude
Исходники
Присутствуют
Сборка
26360
Hello experts, i'm using l2scripts zaken and all duelist/GK skills who need charges to use are bugged, because you can use without charges so how i fix it?

So the skill can be used with 0 charges, if you have 3 charges it consumes 3 charges.

Skill example: Break Duress (grand khavatari)
Код:
    <skill id="461" levels="3" name="Break Duress">
        <!--
            Description:
            Lvl 1 - Use your spirit to escape from an immobile state. Level 2 Focused Force charge required.
            Lvl 2 - Use your spirit to escape from a slow or immobile state. Level 3 Focused Force charge required.
        -->
        <table name="#num_charges">2 3</table>
        <table name="#magicLevel">60 66</table>
        <table name="#dispel_sd_max_abnormal_lvl">0 3</table>
        <table name="#mp_consume">29 33 37</table>
        <table name="#reuseDelay">600000 420000 300000</table>
        <set name="icon" value="icon.skill0461"/>
        <set name="reuseDelay" value="#reuseDelay"/>
        <set name="hitTime" value="3000"/>
        <set name="mp_consume" value="#mp_consume"/>
        <set name="ride_state" value="NONE"/>
        <set name="magicLevel" value="#magicLevel"/>
        <set name="hitCancelTime" value="500"/>
        <set name="target" value="TARGET_SELF"/>
        <set name="operate_type" value="A2"/>
        <set name="num_charges" value="#num_charges"/>
        <set name="skillType" value="BUFF"/>
        <for>
            <effect name="i_dispel_by_slot">
                <def name="abnormal_type" value="speed_down"/>
                <def name="max_abnormal_level" value="#dispel_sd_max_abnormal_lvl"/>
            </effect>
            <effect name="i_dispel_by_slot">
                <def name="abnormal_type" value="root_magically"/>
                <def name="max_abnormal_level" value="3"/>
            </effect>
            <effect name="i_dispel_by_slot">
                <def name="abnormal_type" value="root_physically"/>
                <def name="max_abnormal_level" value="3"/>
            </effect>
        </for>
    </skill>
 
Here is Charge.java

package l2s.gameserver.skills.skillclasses;

import java.util.List;

import l2s.gameserver.model.Creature;
import l2s.gameserver.model.Player;
import l2s.gameserver.model.Skill;
import l2s.gameserver.network.l2.components.SystemMsg;
import l2s.gameserver.network.l2.s2c.MagicSkillUse;
import l2s.gameserver.stats.Formulas;
import l2s.gameserver.stats.Formulas.AttackInfo;
import l2s.gameserver.templates.StatsSet;

public class Charge extends Skill
{
public static final int MAX_CHARGE = 10;

private int _charges;
private boolean _fullCharge;

public Charge(StatsSet set)
{
super(set);
_charges = set.getInteger("charges", getLevel());
_fullCharge = set.getBool("fullCharge", false);
}

@Override
public boolean checkCondition(final Creature activeChar, final Creature target, boolean forceUse, boolean dontMove, boolean first)
{
if(!super.checkCondition(activeChar, target, forceUse, dontMove, first))
return false;

if(!activeChar.isPlayer())
return false;

Player player = (Player) activeChar;

int charges = _charges == -1 ? player.getMaxIncreasedForce() : _charges;

//Камушки можно юзать даже е�ли зар�д > 7, о�тальное только е�ли зар�д < уровень �кила
if(getPower() <= 0 && getId() != 2165 && player.getIncreasedForce() >= charges)
{
activeChar.sendPacket(SystemMsg.YOUR_FORCE_HAS_REACHED_MAXIMUM_CAPACITY_);
return false;
}
else if(getId() == 2165)
player.sendPacket(new MagicSkillUse(player, player, 2165, 1, 0, 0));

return true;
}

@Override
public void onEndCast(Creature activeChar, List<Creature> targets)
{
super.onEndCast(activeChar, targets);

if(activeChar.isPlayer())
chargePlayer((Player) activeChar, getId());
}

@Override
protected void useSkill(Creature activeChar, Creature target, boolean reflected)
{
if(!activeChar.isPlayer())
return;

if(target.isDead())
return;

if(target == activeChar)
return;

if(getPower() <= 0)
return;

final Creature realTarget = reflected ? activeChar : target;
final AttackInfo info = Formulas.calcPhysDam(activeChar, realTarget, this, false, false, isSSPossible(), false);
if(info == null)
return;

realTarget.reduceCurrentHp(info.damage, activeChar, this, true, true, false, true, false, false, true, true, info.crit || info.blow, false, false);
if(!info.miss || info.damage >= 1)
{
double lethalDmg = Formulas.calcLethalDamage(activeChar, realTarget, this);
if(lethalDmg > 0)
realTarget.reduceCurrentHp(lethalDmg, activeChar, this, true, true, false, false, false, false, false);
else if(!reflected)
realTarget.doCounterAttack(this, activeChar, false);
}
}

public void chargePlayer(Player player, Integer skillId)
{
int charges = _charges == -1 ? player.getMaxIncreasedForce() : _charges;
if(player.getIncreasedForce() >= charges)
{
player.sendPacket(SystemMsg.YOUR_FORCE_HAS_REACHED_MAXIMUM_CAPACITY_);
return;
}
if(_fullCharge)
player.setIncreasedForce(charges);
else
player.setIncreasedForce(player.getIncreasedForce() + 1);
}
 
You wanna add condition numCharhes for player then it work
 
Try to use this condition in your skill:
Код:
<cond>
    <player chargesMin="3" />
</cond>

Код:
package l2s.gameserver.stats.conditions;

import l2s.gameserver.stats.Env;

public class ConditionPlayerChargesMin extends Condition
{
    private final int _minCharges;

    public ConditionPlayerChargesMin(int minCharges)
    {
        _minCharges = minCharges;
    }

    @Override
    protected boolean testImpl(Env env)
    {
        if(env.character == null || !env.character.isPlayer())
            return false;

        return env.character.getIncreasedForce() >= _minCharges;
    }
}
 
  • Мне нравится
Реакции: kick
this condition aren't in my skill.dtd how can i add it? because if i add manual i get error.

<!ELEMENT player (#PCDATA)>
<!ATTLIST player
residence CDATA #IMPLIED
olympiad CDATA #IMPLIED
race CDATA #IMPLIED
instance_zone CDATA #IMPLIED
is_clan_leader CDATA #IMPLIED
is_hero CDATA #IMPLIED
sex CDATA #IMPLIED
classId CDATA #IMPLIED
minLevel CDATA #IMPLIED
max_level CDATA #IMPLIED
avail_max_sp CDATA #IMPLIED
quest_state CDATA #IMPLIED
min_pledge_rank CDATA #IMPLIED
class_type CDATA #IMPLIED
summon_siege_golem CDATA #IMPLIED
running CDATA #IMPLIED
percentHP CDATA #IMPLIED
resting CDATA #IMPLIED
max_level CDATA #IMPLIED
maxPK CDATA #IMPLIED
percentMP CDATA #IMPLIED
moving CDATA #IMPLIED
standing CDATA #IMPLIED
damage CDATA #IMPLIED
percentCP CDATA #IMPLIED
direction CDATA #IMPLIED
riding CDATA #IMPLIED
flying CDATA #IMPLIED
castle_type CDATA #IMPLIED
min_clan_level CDATA #IMPLIED
has_abnormal_type CDATA #IMPLIED
has_summon_id CDATA #IMPLIED
can_transform CDATA #IMPLIED
can_untransform CDATA #IMPLIED
agathion CDATA #IMPLIED
hasBuffId CDATA #IMPLIED
flyingTransform CDATA #IMPLIED
isFlagged CDATA #IMPLIED
can_learn_skill CDATA #IMPLIED
is_chaotic CDATA #IMPLIED>
 
hmm skill.dtd in source = skills.java? player.java? my java knowledge is begginer

-added the ConditionPlayerCharges.java shared by Lorn to my core.
-added the condition in the skill.
<set name="charge_skill_id" value="50"/>
<set name="useSS" value="true"/>
<cond>
<player chargesMin="1" />
</cond>

<cond msgId="113">
-added the condition to skill.dtd.
is_chaotic CDATA #IMPLIED
chargesMin CDATA #IMPLIED>

No errors/warnings, but the skill still can be used without charges, if you have 1 charge it get consumed.

i can pay via paypal if someone helps me =)
 
You should add this else-if block in parsePlayerCondition method in gameserver/data/xml/parser/StatParser.java
Код:
else if("chargesMin".equalsIgnoreCase(name)) {
    int val = parseNumber(value).intValue();
    cond = joinAnd(cond, new ConditionPlayerChargesMin(val));
}
 
  • Мне нравится
Реакции: kick
Lorn,
You should add this else-if block in parsePlayerCondition method in gameserver/data/xml/parser/StatParser.java
Код:
else if("chargesMin".equalsIgnoreCase(name)) {
    int val = parseNumber(value).intValue();
    cond = joinAnd(cond, new ConditionPlayerChargesMin(val));
}

it works!!! ty so much :OnionHead:
 

Похожие темы

Ответы
0
Просмотры
596
Назад
Сверху Снизу