📄 magic.pas
字号:
if PlayObject.IsProperTarget (TargeTBaseObject) then begin
if MagTurnUndead(PlayObject,TargeTBaseObject,nTargetX,nTargetY,UserMagic.btLevel) then
boTrain:=True;
end;
end;
SKILL_SNOWWIND{33}: begin
if MagBigExplosion(PlayObject,
PlayObject.GetAttackPower(GetPower(MPow(UserMagic)) + LoWord(PlayObject.m_WAbil.MC),SmallInt(HiWord(PlayObject.m_WAbil.MC)-LoWord(PlayObject.m_WAbil.MC))+ 1),
nTargetX,
nTargetY,
g_Config.nSnowWindRange{1}) then
boTrain:=True;
end;
{###########NEW SPELLS START HERE #############}
{ {34} {Crosshalfmoon}
SKILL_FLAMEDIS{35}: {FlameDisruptor - Wizard}
if PlayObject.IsProperTarget (TargeTBaseObject) then begin
if (Random(50) >= TargeTBaseObject.m_nAntiMagic) then begin
nFlamePower:=0;
nPower:= PlayObject.GetAttackPower (GetPower(MPow(UserMagic)) + LoWord(PlayObject.m_WAbil.MC),
SmallInt(HiWord(PlayObject.m_WAbil.MC)-LoWord(PlayObject.m_WAbil.MC))+ 1);
if TargeTBaseObject.m_btLifeAttrib <> LA_UNDEAD then
nFlamePower:=ROUND(nPower * 0.15);
nPower:=nPower + nFlamePower;
PlayObject.SendDelayMsg(PlayObject,RM_DELAYMAGIC,nPower,MakeLong(nTargetX,nTargetY),2,Integer(TargeTBaseObject),'',600);
if TargeTBaseObject.m_btRaceServer >= RC_ANIMAL then
boTrain:=True;
end else TargeTBaseObject:=nil
end else TargeTBaseObject:=nil;
SKILL_ENHANCER{36}: begin {UltimateEnhancer - Taoist}
boSpellFail:=True;
if TargeTBaseObject = nil then begin
TargeTBaseObject:=PlayObject;
nTargetX:=PlayObject.m_nCurrX;
nTargetY:=PlayObject.m_nCurrY;
end;
if PlayObject.IsProperFriend(TargeTBaseObject) then begin
if CheckAmulet(PlayObject,1,1,nAmuletIdx) then begin
UseAmulet(PlayObject,1,1,nAmuletIdx);
nPower := (UserMagic.btLevel + 1) {* 2} + Random(UserMagic.btLevel);
n14 := PlayObject.GetAttackPower(GetPower13(60) + LoWord(PlayObject.m_WAbil.SC) * 10,SmallInt(HiWord(PlayObject.m_WAbil.SC)-LoWord(PlayObject.m_WAbil.SC))+ 1);
// Only send the animation if it's on somebody else
if PlayObject <> TargeTBaseObject then
TargeTBaseObject.SendRefMsg(RM_10205,0,0,0,15,'');
if TargeTBaseObject.AttPowerUp(nPower, n14) then boTrain:=True;
boSpellFail:=False;
end;
end;
end;
SKILL_ENERGYREPULSOR{37}: begin {EnergyRepulsor - Taoist}
if MagPushArround(PlayObject,UserMagic.btLevel) > 0 then boTrain:=True;
end;
{ {38} {TwinDragonBlade - Warrior}
SKILL_FROST{39}: begin {FrostCrunch - Wizard}
if MagHbFireBall(PlayObject,UserMagic,nTargetX, nTargetY,TargeTBaseObject) then boTrain:=True;
end;
SKILL_PURI{40}: begin {Purification - Taoist}
nPower := ((UserMagic.btLevel shl 4) - UserMagic.btLevel + 45);
if MagMakeGroupUnPoison(PlayObject, nTargetX, nTargetY, nPower) then
boTrain := True;
end;
SKILL_ANGEL{41}: begin {SummonHolyDeva - Taoist}
boSpellFail:=True;
if CheckAmulet(PlayObject,2,1,nAmuletIdx) then begin
UseAmulet(PlayObject,2,1,nAmuletIdx);
if MagMakeAngelSlave(PlayObject,UserMagic) then
boTrain:=True;
boSpellFail:=False;
end;
end;
SKILL_MIRROR{42}: begin {Mirroring - Wizard}
if MagMakeClone(PlayObject,UserMagic) then
boTrain:=True;
end;
SKILL_LION{43}: begin {LionRoar - Warrior}
if MagGroupMb(PlayObject,UserMagic,TargeTBaseObject) then boTrain:=True;
end;
SKILL_BLADEAV{44}: begin {BladeAvalanche - Warrior}
if BladeAvalanche(Playobject,UserMagic,TargeTBaseObject) then boTrain:=True;
end;
SKILL_FLAMEFIELD{45}: begin {FlameField - Wizard}
if MagFireField(PlayObject,PlayObject.GetAttackPower (GetPower(MPow(UserMagic)) + LoWord(PlayObject.m_WAbil.MC),SmallInt(HiWord(PlayObject.m_WAbil.MC)-LoWord(PlayObject.m_WAbil.MC))+ 1)) then
boTrain:=True;
end;
SKILL_ENTRAP{47}: begin {Entrapment - Warrior}
If PlayObject.IsProperTarget(TargeTBaseObject) then begin
if (TargeTBaseObject.m_btRaceServer < RC_ANIMAL) then exit;
if TargeTBaseObject.m_wStatusTimeArr[POISON_STONE] <> 0 then exit;
if TargeTBaseObject.m_Abil.Level <= PlayObject.m_abil.Level+8 then begin
n14 := Random(5) - (UserMagic.btLevel + 1);
EntrapDir:=GetNextDirection(TargeTBaseObject.m_nCurrX,TargeTBaseObject.m_nCurrY,PlayObject.m_nCurrX,PlayObject.m_nCurrY);
EntrapDist:=Max(ABS(TargeTBaseObject.m_nCurrX-PlayObject.m_nCurrX),ABS(TargeTBaseObject.m_nCurrY-PlayObject.m_nCurrY))-1;
if n14 <= 0 then begin
TargeTBaseObject.CharPushed(EntrapDir,EntrapDist);
TargeTBaseObject.MakePosion(POISON_STONE,UserMagic.btLevel + 3,0);
end;
if TargetBaseObject.m_btRaceServer = RC_PLAYOBJECT then begin
TargetBaseObject.SetPKFlag(PlayObject);
TargetBaseObject.SetLastHiter(PlayObject);
end;
if TargeTBaseObject.m_btRaceServer >= RC_ANIMAL then boTrain:=True; //silly person it could never get to this line if it wasnt animal or above :p
end;
end;
end;
SKILL_VAMP{48}: begin {Vampirism - Wizard}
if PlayObject.IsProperTarget (TargeTBaseObject) then begin
if (Random(50) >= TargeTBaseObject.m_nAntiMagic) then begin
with PlayObject do begin
nPower:= GetAttackPower (GetPower(MPow(UserMagic)) + LoWord(m_WAbil.MC),
SmallInt(HiWord(m_WAbil.MC)-LoWord(m_WAbil.MC)) + 1);
end;
VampPower := round(npower div 5);
if VampPower < 0 then begin
// Dont want to drain our own HP, so skill failed.
PlayObject.SysMsg('Attack Failed',c_Red,t_Hint);
exit;
end;
PlayObject.SendDelayMsg(PlayObject,RM_DELAYMAGIC,nPower,MakeLong(nTargetX,nTargetY),2,Integer(TargeTBaseObject),'',1000);
if PlayObject.m_WAbil.HP + VampPower > PlayObject.m_WAbil.MaxHP then begin
PlayObject.m_WAbil.HP := PlayObject.m_WAbil.MaxHP;
end else
PlayObject.m_WAbil.HP := PlayObject.m_WAbil.HP + VampPower;
PlayObject.SendDelayMsg(PlayObject,RM_10205,0,PlayObject.m_nCurrX,PlayObject.m_nCurrY,13{type},'',1000);
playobject.RecalcAbilitys();
playobject.SendMsg(playobject,RM_ABILITY,0,0,0,0,'');
if TargeTBaseObject.m_btRaceServer >= RC_ANIMAL then
boTrain:=True;
end else TargeTBaseObject:=nil
end else TargeTBaseObject:=nil;
end;
SKILL_HALLUC{49}: begin {Hallucination - Taoist}
//Hallucination
boSpellFail:=True;
n14 := Random(5) - (UserMagic.btLevel + 1);
if CheckAmulet(PlayObject,1,1,nAmuletIdx) and (TargeTBaseObject <> nil) and (n14 <= 0) then begin
if (TargeTBaseObject.m_btRaceServer <> RC_NPC) and (TargeTBaseObject.m_btRaceServer <> RC_PLAYOBJECT) then begin
UseAmulet(PlayObject,1,1,nAmuletIdx);
If TargeTBaseObject.m_Abil.Level < PlayObject.m_abil.Level then begin
nPower:= PlayObject.GetAttackPower (GetPower(MPow(UserMagic)) + LoWord(PlayObject.m_WAbil.SC) * 2,
SmallInt(HiWord(PlayObject.m_WAbil.SC)-LoWord(PlayObject.m_WAbil.SC)) * 2 + 1);
TargeTBaseObject.OpenHallucMode(Random(n14) + nPower - 20);
boTrain:=True;
boSpellFail:=False;
end;
end;
end;
end;
SKILL_RAGE{50}: begin {Rage - Warrior}
boSpellFail:=True;
nPower := Round(HiWord(PlayObject.m_WAbil.DC) * (0.12 + (0.03*UserMagic.btLevel)))-2;
n14 := 18+(6*UserMagic.btLevel);
if PlayObject.AttPowerUp(nPower, n14) then boTrain:=True;
boSpellFail:=False;
end;
SKILL_PROTECTIONFIELD{51}: begin {ProtectionField - Warrior}
// EFFECT REMOVED UNTIL MORE DETAILS ON ALGORITHM KNOWN
end;
SKILL_ICESHOWER{52}: begin {Blizzard - Wizard}
end;
SKILL_FIRESHOWER{53}: begin {MeteorShower - Wizard}
end;
SKILL_MASSPOISON{55}: begin {PoisonCloud - Taoist}
end;
end;
if boSpellFail then exit;
if boSpellFire then begin
PlayObject.SendRefMsg(RM_MAGICFIRE,0,
MakeWord(UserMagic.MagicInfo.btEffectType,UserMagic.MagicInfo.btEffect),
MakeLong(nTargetX,nTargetY),
Integer(TargeTBaseObject),
'');
end;
if (UserMagic.btLevel < 3) and (boTrain) then begin
if UserMagic.MagicInfo.TrainLevel[UserMagic.btLevel] <= PlayObject.m_Abil.Level then begin
PlayObject.TrainSkill(UserMagic,Random(3) + 1);
if not PlayObject.CheckMagicLevelup(UserMagic) then begin
PlayObject.SendDelayMsg(PlayObject,RM_MAGIC_LVEXP,0,UserMagic.MagicInfo.wMagicId,UserMagic.btLevel,UserMagic.nTranPoint,'',1000);
end;
end;
end;
Result:=True;
end;
function TMagicManager.MagMakePrivateTransparent(BaseObject: TBaseObject; nHTime: Integer):Boolean; //004930E8
var
I :Integer;
BaseObjectList :TList;
TargeTBaseObject :TBaseObject;
begin
Result:=False;
if BaseObject.m_wStatusTimeArr[STATE_TRANSPARENT{0x70}] > 0 then exit; //4930FE
BaseObjectList:=TList.Create;
BaseObject.GetMapBaseObjects(BaseObject.m_PEnvir,BaseObject.m_nCurrX,BaseObject.m_nCurrY,9,BaseObjectList);
for I := 0 to BaseObjectList.Count - 1 do begin
TargeTBaseObject:=TBaseObject(BaseObjectList.Items[i]);
if (TargeTBaseObject.m_btRaceServer >= RC_ANIMAL) and (TargeTBaseObject.m_TargetCret = BaseObject) then begin
if (abs(TargeTBaseObject.m_nCurrX - BaseObject.m_nCurrX) > 1) or
(abs(TargeTBaseObject.m_nCurrY - BaseObject.m_nCurrY) > 1) or
(Random(2) = 0) then begin
TargeTBaseObject.m_TargetCret:=nil;
end;
end;
end;
BaseObjectList.Free;
BaseObject.m_wStatusTimeArr[STATE_TRANSPARENT{0x70}]:=nHTime; //004931D2
BaseObject.m_nCharStatus:=BaseObject.GetCharStatus();
BaseObject.StatusChanged();
BaseObject.m_boHideMode:=True;
BaseObject.m_boTransparent:=True;
Result:=True;
end;
function TMagicManager.MagTamming(BaseObject, TargeTBaseObject: TBaseObject;
nTargetX, nTargetY, nMagicLevel: Integer): Boolean; //00492368
var
n14:Integer;
begin
Result:=False;
if (TargeTBaseObject.m_btRaceServer = MONSTER_CLONE) then exit;
if (TargeTBaseObject.m_btRaceServer <> RC_PLAYOBJECT) and ((Random(4 - nMagicLevel) = 0)) then begin
TargeTBaseObject.m_TargetCret:=nil;
if TargeTBaseObject.m_Master = BaseObject then begin
TargeTBaseObject.OpenHolySeizeMode((nMagicLevel * 5 + 10) * 1000);
Result:=True;
end else begin
if Random(2) = 0 then begin
if TargeTBaseObject.m_Abil.Level <= BaseObject.m_Abil.Level + 2 then begin
if Random(3) = 0 then begin
if Random((BaseObject.m_Abil.Level + 20) + (nMagicLevel * 5)) > (TargeTBaseObject.m_Abil.Level + g_Config.nMagTammingTargetLevel{10}) then begin
if not(TargeTBaseObject.m_boNoTame) and
(TargeTBaseObject.m_btLifeAttrib <> LA_UNDEAD) and
(TargeTBaseObject.m_Abil.Level < g_Config.nMagTammingLevel{50}) and
(BaseObject.m_SlaveList.Count < g_Config.nMagTammingCount{(nMagicLevel + 2)}) then begin
n14:=TargeTBaseObject.m_WAbil.MaxHP div g_Config.nMagTammingHPRate{100};
if n14 <= 2 then n14:=2
else Inc(n14,n14);
if (TargeTBaseObject.m_Master <> BaseObject) and (Random(n14) = 0) then begin
TargeTBaseObject.BreakCrazyMode();
if TargeTBaseObject.m_Master <> nil then begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -