|
发表于 2024-1-23 17:17:39
|
显示全部楼层
谢谢大佬分享, MARK一下
吸血武器
改这个的位置在哪里?在原码的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);
}
加上以后,就大功告成了 可以开始吸血了!!
|
|