|
|
#region Perfection
if (attacker.PlayerFlag == PlayerFlag.Player)
{
uint rand = (uint)Rayzo.Kernel.Random.Next(1, 2);
switch (rand)
{
case 1:
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.CalmWind;
byte chance = 1;
new MsgRefineEffect().GenerateEffectandChance(attacker.Owner, ref effect, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacker, attacked, effect);
}
#endregion
break;
}
case 2:
{
#region Perfection
byte chance = 0;
new MsgRefineEffect().HandleLuckyStrike(attacker, ref chance);
if (Kernel.Rate(chance))
{
Network.Writer.WriteUInt16((ushort)(1 << 10), 36, attack.ToArray());
new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
damage *= 3 / 2;
}
#endregion
break;
}
}
}
#endregion
#region Perfection
if (attacked.PlayerFlag == PlayerFlag.Player)
{
uint rand = (uint)Rayzo.Kernel.Random.Next(1, 2);
switch (rand)
{
case 1:
{
// if (attacked.PlayerFlag == PlayerFlag.Player)
{
#region Perfection
byte chance = 1;
new MsgRefineEffect().HandleStrickeLock(attacker, ref chance);
if (Kernel.Rate(chance))
{
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.Stricklock;
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
return;
}
#endregion
}
break;
}
case 2:
{
// if (attacked.PlayerFlag == PlayerFlag.Player)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.MirrorofSin;
byte chance = 0;
new MsgRefineEffect().HandleMirror(attacked, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
if (!attacker.ContainsFlag4(Rayzo.Network.GamePackets.MsgUpdate.Flags4.Omnipotence) || !attacker.ContainsFlag3((ulong)Rayzo.Network.GamePackets.MsgUpdate.Flags3.BladeFlurry)) return;
{
attacked.AddFlag((ulong)Network.GamePackets.MsgUpdate.Flags.XPList);
attacker.Owner.XPListStamp = Time32.Now;
}
}
#endregion
}
break;
}
}
}
#endregion
#region Perfection X2
byte Tiempo = 0;
new MsgRefineEffect().HandleLuckyStrike(attacker, ref Tiempo);
if (Kernel.Rate(Tiempo))
{
Network.Writer.WriteUInt16((ushort)(1 << 10), 36, attack.ToArray());
new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
damage = damage * 2;
}
#endregion
#region Perfiction
if (Player.Perfection != null)
{
if (this.Equipment.TotalPerfectionLevel >= Player.Perfection.Id)
{
Player.BaseMinAttack += Player.Perfection.PhysicalAttack;
Player.BaseMaxAttack += Player.Perfection.PhysicalAttack;
Player.Defence += Player.Perfection.PhysicalDefense;
Player.BaseMagicAttack += Player.Perfection.MagicAttack;
Player.MagicDefence += Player.Perfection.MagicDefense;
}
}
public byte GetChance(Client.GameState client, Game.Enums.PerfectionEffect effect)
{
if (client.Equipment.TotalPerfectionLevel == 0) return 0;
byte Chance = 10;
if (effect == Game.Enums.PerfectionEffect.CalmWind)
{
if (client.Equipment.TotalPerfectionLevel == 3) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 90) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 170) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 250) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 285) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.BloodSpawn)
{
if (client.Equipment.TotalPerfectionLevel >= 40) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 240) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 288) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
{
if (client.Equipment.TotalPerfectionLevel <= 40) Chance += 5;
}
if (effect == Game.Enums.PerfectionEffect.CoreStrike)
{
if (client.Equipment.TotalPerfectionLevel == 50) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 80) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 135) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 205) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 245) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
{
if (client.Equipment.TotalPerfectionLevel >= 35) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 220) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 276) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.FreeSoul)
{
if (client.Equipment.TotalPerfectionLevel >= 25) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 95) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 130) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 195) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 279) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.InvisibleArrow)
{
if (client.Equipment.TotalPerfectionLevel >= 65) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 225) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 282) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
{
if (client.Equipment.TotalPerfectionLevel >= 55) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 165) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 294) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.LightofStamina)
{
if (client.Equipment.TotalPerfectionLevel >= 1) Chance += 5;
}
if (effect == Game.Enums.PerfectionEffect.LuckyStrike)
{
if (client.Equipment.TotalPerfectionLevel >= 15) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 115) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 215) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 314) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 320) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.MirrorofSin)
{
if (client.Equipment.TotalPerfectionLevel >= 60) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 190) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 291) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
{
if (client.Equipment.TotalPerfectionLevel == 155 && client.Equipment.TotalPerfectionLevel <= 254) Chance += 50 / 100;
if (client.Equipment.TotalPerfectionLevel == 255 && client.Equipment.TotalPerfectionLevel <= 296) Chance += 70 / 100;
if (client.Equipment.TotalPerfectionLevel == 297 && client.Equipment.TotalPerfectionLevel <= 311) Chance += 1;
if (client.Equipment.TotalPerfectionLevel == 312 && client.Equipment.TotalPerfectionLevel <= 321) Chance += 150 / 100;
if (client.Equipment.TotalPerfectionLevel == 322 && client.Equipment.TotalPerfectionLevel >= 322) Chance += 2;
}
if (effect == Game.Enums.PerfectionEffect.StraightLife)
{
if (client.Equipment.TotalPerfectionLevel >= 30) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 125) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 210) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 265) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 303) Chance += 1;
}
if (effect == Game.Enums.PerfectionEffect.Stricklock)
{
if (client.Equipment.TotalPerfectionLevel >= 30) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 125) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 210) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 265) Chance += 1;
if (client.Equipment.TotalPerfectionLevel >= 303) Chance += 1;
}
return Chance;
}
public void SendEffect(Game.Player attacker, Game.Player attacked, Game.Enums.PerfectionEffect effect)
{
if (attacker == null || attacked == null) return;
var proto = new MsgRefineEffectProto();
proto.AttackerUID = attacker.UID;
if (attacked.PlayerFlag == Game.PlayerFlag.Player)
proto.AttackedUID = attacked.UID;
else if (attacked.PlayerFlag == Game.PlayerFlag.Monster && attacked != null && attacked.UID != 0)
{
proto.AttackedUID = attacked.UID;
}
proto.Effect = (uint)effect;
var proto2 = Kernel.FinalizeProtoBuf(proto, 3254);
attacker.Owner.SendScreen(proto2, true);
if (effect == Game.Enums.PerfectionEffect.DrainingTouch)
{
attacker.Hitpoints = attacker.MaxHitpoints;
}
if (effect == Game.Enums.PerfectionEffect.KillingFlash)
{
if (!attacker.ContainsFlag4(Rayzo.Network.GamePackets.MsgUpdate.Flags4.Omnipotence) || !attacker.ContainsFlag3((ulong)Rayzo.Network.GamePackets.MsgUpdate.Flags3.BladeFlurry)) return;
{
attacker.AddFlag((ulong)Network.GamePackets.MsgUpdate.Flags.XPList);
attacker.Owner.XPListStamp = Time32.Now;
}
}
if (effect == Game.Enums.PerfectionEffect.DivineGuard)
{
attacker.AddFlag3((ulong)Network.GamePackets.MsgUpdate.Flags3.DivineGuard);
attacker.Defence = (ushort)(((attacker.Defence) * 20) / 100);
attacker.DivineGuardStamp = Time32.Now;
}
if (effect == Game.Enums.PerfectionEffect.ShieldBreak)
{
attacker.AddFlag3((ulong)Network.GamePackets.MsgUpdate.Flags3.ShieldBreak);
attacker.ShieldBreakStamp = Time32.Now;
attacker.Block += (ushort)(((attacker.Block) * 2) / 10);
}
if (effect == Game.Enums.PerfectionEffect.StraightLife)
{
attacker.BringToLife();
}
if (effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.PlayerFlag == Game.PlayerFlag.Player && attacker.Owner.Equipment.TotalPerfectionLevel > attacked.Owner.Equipment.TotalPerfectionLevel || effect == Game.Enums.PerfectionEffect.LightofStamina && attacked.PlayerFlag == Game.PlayerFlag.Monster) attacker.Stamina = 100;
}
public void GenerateEffectandChance(Client.GameState client, ref Game.Enums.PerfectionEffect effect, ref byte chance)
{
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(3, 14);
chance = GetChance(client, effect);
while (chance == 10)
{
effect = (Game.Enums.PerfectionEffect)Kernel.Random.Next(3, 14);
chance = GetChance(client, effect);
}
}
public void HandleStrickeLock(Game.Player client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.Stricklock);
}
public void HandleFreeSoul(Game.Player client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.FreeSoul);
}
public void HandleStraightLife(Game.Player client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.StraightLife);
}
public void HandleBloodSpawn(Game.Player client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.BloodSpawn);
}
public void HandleMirror(Game.Player client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.MirrorofSin);
}
public void HandleLuckyStrike(Game.Player client, ref byte chance)
{
chance = GetChance(client.Owner, Game.Enums.PerfectionEffect.LuckyStrike);
}
public ushort TotalPerfectionLevel
{
get
{
ushort Count = 0;
foreach (Network.GamePackets.MsgItemInfo item in Objects)
{
if (item == null) continue;
if (item.Position > 19 || item.Position == 7 || item.Position == 9 || item.Position == 15 || item.Position == 16 || item.Position == 17) continue;
Count += (ushort)(ItemHandler.IsTwoHand(item.ID) ? item.PerfectionLevel * 2 : item.PerfectionLevel);
}
return Count;
}
}
#region Perfection X2
byte Tiempo = 0;
new MsgRefineEffect().HandleLuckyStrike(attacker, ref Tiempo);
if (Kernel.Rate(Tiempo))
{
Network.Writer.WriteUInt16((ushort)(1 << 10), 36, attack.ToArray());
new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
damage = damage * 2;
}
#region Perfection X2
if ((attacker.Perfection != null)(attacked.Perfection != null))
{
if ((attacker.Perfection.Id) > (attacked.Perfection.Id))
{
byte Tiempo = 0;
new MsgRefineEffect().HandleLuckyStrike(attacker, ref Tiempo);
if (Kernel.Rate(Tiempo))
{
Network.Writer.WriteUInt16((ushort)(1 << 10), 36, attack.ToArray());
new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
damage = damage * 2;
}
}
}
#endregion
|
الذين يشاهدون محتوى الموضوع الآن : 3 ( الأعضاء 0 والزوار 3) | |
|