q5127 发表于 2019-7-28 10:17:54

吸血武器制作

吸血武器
改这个的位置在哪里?在原码的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);
}

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

jms2008 发表于 2019-8-29 10:26:38


谢谢版主的无私分享

q2831 发表于 2019-9-11 10:34:32


看看怎么样学习一下

sbuitd1983 发表于 2019-10-13 15:07:59

666666666666666666666

mao188166 发表于 2019-11-11 09:13:13

谢谢版主的无私分享

hdiitw 发表于 2020-2-6 12:02:34

需要載入什麼?

ttm365 发表于 2020-2-25 14:39:41

吸血武器
改这个的位置在哪里?在原码的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);
}

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

大高高 发表于 2020-6-8 07:48:50

谢谢大大的分享            

nudy 发表于 2020-6-28 19:51:09

謝謝分享哦

fans027 发表于 2020-9-27 23:50:08

吸血武器
改这个的位置在哪里?在原码的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);
}

加上以后,就大功告成了 可以开始吸血了!!
页: [1] 2 3
查看完整版本: 吸血武器制作