主页| 免费发布天堂1开机信息| 站长qq:1161903

教你制作吸血武器

来源:2TT天堂发布网 www.2tt.cc    发布时间:2019/3/4 0:58:32    浏览量:1653

吸血武器
改这个的位置在哪里?在原码的l1j.server.server.model.L1Attack.java

public int DrainMana = 0;
下面新增:
public int DrainHp = 0;
--------------------------------------------------------------------------------------------

public void PlayerStaffOfManaCalc()
{
下面新增:
if((weaponId == 41 || weaponId == 57 || weaponId == 14 || weaponId == 256))    // 吸血武器 武器编号可以自己更改
{
int som_lvl = weaponEnchant + 10; // 最大hp吸取量设定
if(som_lvl < 0) som_lvl = 0;
DrainHp = _random.nextInt(som_lvl) + 5;
if(DrainHp > 30)     // 最大hp吸取量限制,红色字体(可以依照自己的喜好把一次吸血上限调高)
{
DrainHp = 30;  红色字体(可以依照自己的喜好把一次吸血上限调高)
}
}
--------------------------------------------------------------------------------------------

private void PcCommit()
{
if(_calcType == PC_PC)
{
下面新增:

if(DrainHp > 0 && targetPlayer.get_currentHp() > 0)
{
if(DrainHp > targetPlayer.get_currentHp())
DrainHp = targetPlayer.get_currentHp();
short newHp = (short) (targetPlayer.get_currentHp() - DrainHp);
targetPlayer.set_currentHp(targetPlayer, newHp);
newHp = (short) (player.get_currentHp() + DrainHp);
player.set_currentHp(player, newHp);
}
--------------------------------------------------------------------------------------------

private void NpcCommit()
{
if(_calcType == PC_NPC)
{
下面新增:

if(DrainHp > 0 && targetNpc.get_currentHp() > 0)
{
if(DrainHp > targetNpc.get_currentHp())
DrainHp = targetNpc.get_currentHp();
//HP吸取限制处理追加
short newHp = (short) (targetNpc.get_currentHp() - DrainHp);
targetNpc.set_currentHp2(newHp);
newHp = (short) (player.get_currentHp() + DrainHp);
player.set_currentHp(player, newHp);
}

加上以后,就大功告成了 可以开始吸血了!!