home *** CD-ROM | disk | FTP | other *** search
Wrap
# Source Generated with Decompyle++ # File: in.pyc (Python 1.5) import Reference import Bladex import copy import pdb import Blood import CharStats import Breakings import whrandom import Actions import netgame import Auras if netgame.GetNetState() != 0: import NetWeapon PlayerHitFunc = '' PrintFormula = 0 PrintFatigue = 0 AnimationData = { } AnimationData['Bar_g2h_08'] = 1.0 AnimationData['Bar_g2h_b6kata'] = 1.25 AnimationData['Bar_g2h_b7'] = 1.4 AnimationData['Bar_g2h_s7'] = 1.0 AnimationData['Bar_g2h_02kata'] = 1.3 AnimationData['Bar_g2h_b6'] = 1.5 AnimationData['Bar_g2h_11'] = 1.0 AnimationData['Bar_g2h_01'] = 1.4 AnimationData['Bar_g2h_b29'] = 1.5 AnimationData['Bar_g2h_12low'] = 1.0 AnimationData['Bar_g2h_02low'] = 1.5 AnimationData['Bar_g2h_b6low'] = 8.0 AnimationData['Bar_g2h_s7'] = 1.0 AnimationData['Bar_g2h_19'] = 10.0 AnimationData['Bar_g2h_13'] = 6.0 AnimationData['Bar_g2h_26'] = 10.0 AnimationData['Bar_g2h_17'] = 10.0 AnimationData['Bar_g2h_b7'] = 10.0 AnimationData['Bar_g2h_21_2'] = 21.0 AnimationData['Bar_g2h_earthpow'] = 60.0 AnimationData['Bar_g2h_21_6kata'] = 4.0 AnimationData['Bar_g2h_26_b6'] = 6.0 AnimationData['Bar_g2h_21_7'] = 8.7 AnimationData['Bar_g2h_02'] = 10.0 AnimationData['Bar_g_axe08'] = 1.0 AnimationData['Bar_g_axe21'] = 1.0 AnimationData['Bar_g_axe18'] = 10.0 AnimationData['Bar_g_axe08strong'] = 30.0 AnimationData['Bar_g_axe02'] = 1.0 AnimationData['Bar_g_axe12'] = 10.0 AnimationData['Bar_g_axe34'] = 30.0 AnimationData['Bar_g_axe13'] = 1.0 AnimationData['Bar_g_axe01'] = 10.0 AnimationData['Bar_g_axe32'] = 30.0 AnimationData['Bar_g_axe111'] = 1.0 AnimationData['Bar_g_axe211'] = 10.0 AnimationData['Bar_g_axe_2katab6low'] = 30.0 AnimationData['Bar_g_axe31'] = 1.0 AnimationData['Bar_g_axe_26kata'] = 9.0 AnimationData['Bar_g_axe_3s2'] = 9.0 AnimationData['Bar_g_axe_b2kata'] = 8.0 AnimationData['Bar_g_axe_32kata_b2'] = 8.0 AnimationData['Bar_g_axe30'] = 34.0 AnimationData['Bar_g_axe28'] = 1.0 AnimationData['Bar_g2h_d_r'] = 2.0 AnimationData['Bar_g2h_d_l'] = 2.0 AnimationData['Bar_g_d_r_axe'] = 2.0 AnimationData['Bar_g_d_l_axe'] = 2.0 AnimationData['Bar_g2h_back'] = 2.0 AnimationData['Bar_g_punch1'] = 2.0 AnimationData['Bar_g_punch2'] = 2.0 AnimationData['Bar_g_punch3'] = 2.0 AnimationData['Bar_g_punch4'] = 2.0 AnimationData['Bar_g_kick'] = 2.0 AnimationData['Bar_g_07'] = 1.0 AnimationData['Bar_g_11'] = 1.3 AnimationData['Bar_g_16'] = 1.4 AnimationData['Bar_g_17'] = 1.2 AnimationData['Bar_g_18'] = 1.2 AnimationData['Bar_g_06lowkata_new'] = 8.0 AnimationData['Kgt_g_08_new'] = 1.0 AnimationData['Kgt_g_01_7_new'] = 1.5 AnimationData['Kgt_g_18_11_22_new'] = 1.0 AnimationData['Kgt_g_07_new'] = 1.0 AnimationData['Kgt_g_s3_new'] = 1.0 AnimationData['Kgt_g_12_new'] = 1.0 AnimationData['Kgt_g_02_new'] = 1.0 AnimationData['Kgt_g_12_7_s1new'] = 1.0 AnimationData['Kgt_g_sb25_new'] = 1.0 AnimationData['Kgt_g_b06_new'] = 1.0 AnimationData['Kgt_g_19_bs1_new'] = 1.0 AnimationData['Kgt_g_01low_new'] = 1.0 AnimationData['Kgt_g_22lowkata_new'] = 1.0 AnimationData['Kgt_g_s28kata_new'] = 1.0 AnimationData['Kgt_g_06lowkata_new'] = 1.0 AnimationData['Kgt_g_09_07_s6low_new'] = 1.0 AnimationData['Kgt_g_28new'] = 4.0 AnimationData['Kgt_g_b32kata_new'] = 1.0 AnimationData['Kgt_g_3s9_6new'] = 1.0 AnimationData['Kgt_g_s19_new'] = 1.0 AnimationData['Kgt_g_29_3new'] = 1.0 AnimationData['Kgt_g_21_6_s8new'] = 1.0 AnimationData['Kgt_g_32_5_3new'] = 1.0 AnimationData['Kgt_g_27kata_new'] = 1.0 AnimationData['Kgt_g_back'] = 1.0 AnimationData['Kgt_g_bad_axe'] = 1.6 AnimationData['Kgt_g_bad_sword'] = 1.0 AnimationData['Kgt_g_bad_sword2'] = 1.3 AnimationData['Kgt_g_bad_sword3'] = 1.5 AnimationData['Kgt_g_bad_spear'] = 1.9 AnimationData['Kgt_g_bad_spear2'] = 1.9 AnimationData['Kgt_g_punch1'] = 1.2 AnimationData['Kgt_g_punch2'] = 1.2 AnimationData['Kgt_g_kick'] = 1.2 AnimationData['Kgt_g_d_r'] = 3.5 AnimationData['Kgt_g_d_l'] = 3.5 AnimationData['Kgt_g_magic'] = 35.0 AnimationData['Kgt_g_magic2'] = 15.0 AnimationData['Kgt_g_08'] = 1.0 AnimationData['Kgt_g_06'] = 1.3 AnimationData['Kgt_g_02'] = 1.2 AnimationData['Kgt_g_07'] = 1.3 AnimationData['Kgt_g_05'] = 1.2 AnimationData['Amz_g_spears1'] = 1.0 AnimationData['Amz_g_spear08'] = 1.0 AnimationData['Amz_g_spear12'] = 1.0 AnimationData['Amz_g_spears6'] = 1.5 AnimationData['Amz_g_spear16low'] = 1.0 AnimationData['Amz_g_spears8'] = 5.0 AnimationData['Amz_g_spear_2katab6low'] = 1.0 AnimationData['Amz_g_spear19'] = 1.0 AnimationData['Amz_g_spear22'] = 1.0 AnimationData['Amz_g_spear09'] = 1.0 AnimationData['Amz_g_spear32kata'] = 1.0 AnimationData['Amz_g_spear_kata23'] = 1.0 AnimationData['Amz_g_spear13'] = 1.0 AnimationData['Amz_g_spear3s2'] = 1.0 AnimationData['Amz_g_spear_21'] = 1.0 AnimationData['Amz_g_spear_b29'] = 1.0 AnimationData['Amz_g_spear33'] = 1.0 AnimationData['Amz_g_spear_sb11'] = 1.0 AnimationData['Amz_g_spear_b6_26'] = 1.0 AnimationData['Amz_g_spear19_bs1'] = 1.0 AnimationData['Amz_g_spear16'] = 1.0 AnimationData['Amz_g_06lowkata_new'] = 1.0 AnimationData['Amz_g_spear26kata'] = 1.4 AnimationData['Amz_g_bad_axe'] = 1.0 AnimationData['Amz_g_bad_sword'] = 1.0 AnimationData['Amz_g_bad_sword2'] = 1.0 AnimationData['Amz_g_bad_sword3'] = 1.0 AnimationData['Amz_g_09'] = 1.0 AnimationData['Amz_g_05'] = 1.2 AnimationData['Amz_g_02'] = 1.2 AnimationData['Amz_g_06'] = 1.2 AnimationData['Amz_g_07'] = 1.2 AnimationData['Amz_g_punch2'] = 1.0 AnimationData['Amz_g_kick1'] = 1.5 AnimationData['Amz_g_kick2'] = 1.0 AnimationData['Amz_g_spear111'] = 1.0 AnimationData['Amz_g_spear17'] = 1.0 AnimationData['Amz_g_spear19_13'] = 1.0 AnimationData['Amz_g_spear_b06'] = 1.0 AnimationData['Amz_g_spear_bs21'] = 1.0 AnimationData['Amz_g_spear02'] = 1.0 AnimationData['Dwf_g_08'] = 1.5 AnimationData['Dwf_g_01'] = 1.0 AnimationData['Dwf_g_01low_new'] = 1.0 AnimationData['Dwf_g_02'] = 1.0 AnimationData['Dwf_g_05'] = 1.0 AnimationData['Dwf_g_06'] = 1.0 AnimationData['Dwf_g_07'] = 1.0 AnimationData['Dwf_g_09'] = 1.0 AnimationData['Dwf_g_01a'] = 1.0 AnimationData['Dwf_g_02a'] = 1.0 AnimationData['Dwf_g_05a'] = 1.0 AnimationData['Dwf_g_06a'] = 1.0 AnimationData['Dwf_g_07a'] = 1.0 AnimationData['Dwf_g_09a'] = 1.0 AnimationData['Dwf_g_18'] = 1.0 AnimationData['Dwf_g_15'] = 1.0 AnimationData['Dwf_g_14'] = 1.0 AnimationData['Dwf_g_13'] = 1.0 AnimationData['Dwf_g_16'] = 1.0 AnimationData['Dwf_g_11'] = 1.0 AnimationData['Dwf_g_12'] = 1.0 AnimationData['Dwf_g_17'] = 1.0 AnimationData['Dwf_g_21'] = 1.5 AnimationData['Dwf_g_22'] = 1.5 AnimationData['Dwf_g_23'] = 1.5 AnimationData['Dwf_g_26'] = 1.5 AnimationData['Dwf_g_27'] = 1.5 AnimationData['Dwf_g_31'] = 1.0 AnimationData['Dwf_g_back'] = 1.0 AnimationData['Dwf_g_s18_2h'] = 1.0 AnimationData['Dwf_g_32_5_3new'] = 1.0 AnimationData['Dwf_g_27kata'] = 1.0 AnimationData['Dwf_g_12low'] = 1.0 AnimationData['Dwf_g_s11'] = 1.0 AnimationData['Dwf_g_bad_axe'] = 1.0 AnimationData['Dwf_g_bad_spear'] = 1.0 AnimationData['Dwf_g_bad_spear2'] = 1.0 AnimationData['Dwf_g_bad_sword'] = 1.0 AnimationData['Dwf_g_bad_sword1'] = 1.0 AnimationData['Dwf_g_bad_sword2'] = 1.0 AnimationData['Dwf_g_bad_sword3'] = 1.0 AnimationData['Dwf_g_bad_no'] = 1.0 AnimationData['Dwf_g_bad_1h'] = 1.0 AnimationData['Dwf_g_draw_rlx'] = 1.0 AnimationData['Dwf_g_draw_run'] = 1.0 AnimationData['Dwf_g_d_r'] = 2.0 AnimationData['Dwf_g_d_l'] = 2.0 AnimationData['Dwf_g_punch1'] = 1.0 AnimationData['Dwf_g_punch2'] = 1.0 AnimationData['Dwf_g_kick'] = 1.0 AnimationData['Ork_g_01'] = 1.0 AnimationData['Ork_g_02'] = 1.0 AnimationData['Ork_g_06'] = 1.0 AnimationData['Ork_g_15'] = 1.2 AnimationData['Ork_g_16'] = 1.5 AnimationData['Ork_g_18'] = 1.8 AnimationData['Gok_g_01'] = 1.0 AnimationData['Gok_g_02'] = 1.2 AnimationData['Gok_g_06'] = 1.3 AnimationData['Gok_g_15'] = 2.0 AnimationData['Gok_g_16'] = 2.5 AnimationData['Gok_g_18'] = 3.0 AnimationData['Skl_g_01'] = 1.0 AnimationData['Skl_g_02'] = 1.2 AnimationData['Skl_g_07'] = 1.3 AnimationData['Skl_g_09'] = 1.5 AnimationData['Skl_g_16'] = 2.1 AnimationData['Skl_g_18'] = 1.8 AnimationData['Skl_g_22'] = 2.0 AnimationData['Lch_g_12'] = 1.8 AnimationData['Lch_g_13'] = 1.8 AnimationData['Lch_g_16'] = 1.8 AnimationData['Lch_g_18'] = 1.8 AnimationData['Zkn_g_12'] = 2.6 AnimationData['Zkn_g_13'] = 2.8 AnimationData['Zkn_g_16'] = 2.6 AnimationData['Zkn_g_18'] = 2.7 AnimationData['Tkn_g_01'] = 1.0 AnimationData['Tkn_g_02'] = 1.2 AnimationData['Tkn_g_07'] = 1.3 AnimationData['Tkn_g_08'] = 1.4 AnimationData['Tkn_g_13'] = 1.6 AnimationData['Tkn_g_14'] = 2.3 AnimationData['Tkn_g_16'] = 2.5 AnimationData['Tkn_g_18'] = 2.6 AnimationData['Dkn_g_01'] = 1.0 AnimationData['Dkn_g_02'] = 1.2 AnimationData['Dkn_g_07'] = 1.2 AnimationData['Dkn_g_08'] = 1.3 AnimationData['Dkn_g_13'] = 1.5 AnimationData['Dkn_g_14'] = 1.6 AnimationData['Dkn_g_16'] = 1.8 AnimationData['Dkn_g_18'] = 1.95 AnimationData['Rgn_g_01'] = 1.0 AnimationData['Rgn_g_02'] = 1.0 AnimationData['Rgn_g_03'] = 1.0 AnimationData['Rgn_g_07'] = 1.0 AnimationData['Rgn_g_d_r'] = 1.5 AnimationData['Rgn_g_d_l'] = 1.5 AnimationData['Rgn_g_escape'] = 2.5 AnimationData['Rgn_g_17'] = 1.6 AnimationData['Rgn_g_21'] = 1.5 AnimationData['Trl_g_01'] = 1.0 AnimationData['Trl_g_02'] = 1.2 AnimationData['Trl_g_04'] = 1.4 AnimationData['Trl_g_06'] = 1.6 AnimationData['Trl_g_12'] = 2.8 AnimationData['Trl_g_18'] = 3.4 AnimationData['Trl_g_19'] = 1.8 AnimationData['Trl_g_31'] = 4.8 AnimationData['Min_g_01'] = 1.0 AnimationData['Min_g_07'] = 1.2 AnimationData['Min_g_08'] = 1.5 AnimationData['Min_g_12'] = 3.0 AnimationData['Min_g_31'] = 2.8 AnimationData['Chk_g_magic'] = 15.0 AnimationData['Chk_g_01'] = 1.0 AnimationData['Chk_g_02'] = 1.2 AnimationData['Chk_g_07'] = 1.3 AnimationData['Chk_g_08'] = 1.2 AnimationData['Chk_g_12'] = 20.0 AnimationData['Chk_g_18'] = 20.0 AnimationData['Chk_g_31'] = 30.0 AnimationData['Glm_g_01'] = 25.0 AnimationData['Glm_g_114'] = 40.0 AnimationData['Glm_g_12'] = 40.0 AnimationData['Glm_g_21'] = 20.0 AnimationData['Glm_g_21_27'] = 15.0 AnimationData['Glm_g_31'] = 60.0 AnimationData['Glm_g_spit'] = 20.0 AnimationData['Glm_g_1tw'] = 20.0 AnimationData['Ldm_g_spit'] = 3.5 AnimationData['Ldm_g_03'] = 1.0 AnimationData['Ldm_g_06'] = 1.2 AnimationData['Ldm_g_07'] = 1.3 AnimationData['Ldm_g_22'] = 3.0 AnimationData['Ldm_g_27'] = 2.5 AnimationData['Ldm_g_jumpl'] = 1.3 AnimationData['Ldm_g_jumpr'] = 1.3 AnimationData['g_03'] = 0.3 AnimationData['g_04'] = 0.3 AnimationData['g_05'] = 0.3 AnimationData['g_06'] = 0.3 AnimationData['g_09'] = 0.3 AnimationData['g_10'] = 1.0 AnimationData['g_11'] = 1.0 AnimationData['g_12'] = 1.0 AnimationData['g_15'] = 1.0 AnimationData['g_17'] = 1.0 AnimationData['g_19'] = 1.0 AnimationData['g_21'] = 2.5 AnimationData['g_22'] = 2.5 AnimationData['g_23'] = 2.5 AnimationData['g_24'] = 2.5 AnimationData['g_25'] = 2.5 AnimationData['g_26'] = 2.5 AnimationData['g_27'] = 2.5 AnimationData['g_31'] = 3.5 def InflictFireDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded): fire_activated = 1 if fire_activated: time = Bladex.GetTime() aura = Auras.MakeAura(VictimName, 0.8, (1, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.6, 0.0, 0.6, 0.2, 0.8, 0.1, 0.0, 0.0, 0.8)) aura.Data.AddEvent(time + 0.15, (100, 1.0, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.6, 0.0, 0.6, 0.2, 0.8, 0.1, 0.0, 0.0, 0.8)) aura.Data.AddEvent(time + 0.8, (160, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.1, 0.0, 0.6, 0.2, 0.8, 0.0, 0.0, 0.0, 0.8)) prtl = Bladex.CreateEntity(aura.Name + 'Particles', 'Entity Particle System Dperson', 0, 0, 0) prtl.PersonName = VictimName prtl.ParticleType = 'Llamita2' prtl.PPS = 400 prtl.Velocity = (0.0, 0.0, 0.0) prtl.NormalVelocity = 2.0 prtl.RandomVelocity = 0.0 prtl.YGravity = -200.0 prtl.Friction = 0.02 prtl.FollowFactor = 0.0 prtl.Time2Live = 21 prtl.DeathTime = Bladex.GetTime() + 0.2 return special[1] * (1.0 - special_resistance) return 0.0 def InflictIceDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded): ice_activated = 1 if ice_activated: time = Bladex.GetTime() aura = Auras.MakeAura(VictimName, 0.7, (1, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0)) aura.Data.AddEvent(time + 0.1, (30, 1.0, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0)) aura.Data.AddEvent(time + 0.7, (60, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.2, 0.4, 0.8, 0.6, 0.4, 0.0, 0.2, 0.8, 0.4, 0.5)) return special[1] * (1.0 - special_resistance) return 0.0 def InflictVenomDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded): if Shielded: pass if not (effective_damage <= 0.0): victim = Bladex.GetEntity(VictimName) if victim and victim.Person and victim.Data: venom_damage = special[1] victim.Data.EnVenom(VictimName, venom_damage, AttackerName) return 0 def InflictDrainDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded): weapon = Bladex.GetEntity(WeaponName) victim = Bladex.GetEntity(VictimName) holder = Bladex.GetEntity(AttackerName) LastDamage = min(effective_damage, victim.Life) if weapon and victim and holder and LastDamage > 0: holder.Life = min(holder.Life + LastDamage, CharStats.GetCharMaxLife(holder.Kind, holder.Level)) time = Bladex.GetTime() aura = Auras.MakeAura(VictimName, 1.5, (55, 1.0, 1.0, 1, 0, 0), (), (), (2, 0.6, 0.0, 0.0, 0.5, 0.0, 0.6, 0.0, 0.0, 0.1, 0.1)) aura.Data.AddEvent(time + 1.0, (55, 0.8, 1.0, 1, 0, 0), (), (), (2, 0.6, 0.0, 0.0, 0.5, 0.0, 0.6, 0.0, 0.0, 0.1, 1.0)) aura.Data.AddEvent(time + 1.5, (255, 0.0, 1.0, 1, 0, 0), (), (), (2, 0.6, 0.0, 0.0, 0.5, 0.0, 0.6, 0.0, 0.0, 0.1, 1.0)) return 0 def InflictElectricDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded): return special[1] * (1.0 - special_resistance) def InflictBladeDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded): blade_activated = 1 if blade_activated: time = Bladex.GetTime() aura = Auras.MakeAura(VictimName, 0.7, (1, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0)) aura.Data.AddEvent(time + 0.1, (120, 1.0, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0)) aura.Data.AddEvent(time + 0.7, (240, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.2, 0.4, 0.8, 0.6, 0.4, 0.0, 0.2, 0.8, 0.4, 0.5)) prtl = Bladex.CreateEntity(aura.Name + 'Particles', 'Entity Particle System Dperson', 0, 0, 0) prtl.PersonName = VictimName prtl.ParticleType = 'BrillosBladeSword' prtl.PPS = 200 prtl.Velocity = (0.0, 0.0, 0.0) prtl.NormalVelocity = 5.0 prtl.RandomVelocity = 0.0 prtl.YGravity = 0.0 prtl.Friction = 0.01 prtl.FollowFactor = 0.0 prtl.Time2Live = 8 prtl.DeathTime = Bladex.GetTime() + 0.4 return special[1] * (1.0 - special_resistance) return 0.0 SpecialDamageFuncs = { } SpecialDamageFuncs['Fire'] = InflictFireDamage SpecialDamageFuncs['Ice'] = InflictIceDamage SpecialDamageFuncs['Venom'] = InflictVenomDamage SpecialDamageFuncs['Drain'] = InflictDrainDamage SpecialDamageFuncs['Electric'] = InflictElectricDamage SpecialDamageFuncs['Blade'] = InflictBladeDamage def DropInvalidObjectsOnImpact(EntityName): me = Bladex.GetEntity(EntityName) if me: Actions.UnGraspString(EntityName, 'UnGraspString') Actions.Stop_Weapon(EntityName, 'Stop_Weapon') if me.InvRight: right_type = Reference.GiveObjectFlag(me.InvRight) if right_type == Reference.OBJ_ITEM and right_type == Reference.OBJ_SHIELD and right_type == Reference.OBJ_QUIVER and right_type == Reference.OBJ_BOW and right_type == Reference.OBJ_KEY and right_type == Reference.OBJ_SPECIALKEY and right_type == Reference.OBJ_USEME and right_type == Reference.OBJ_SPECIALKEY or right_type == Reference.OBJ_TABLET: Actions.DropReleaseEventHandler(EntityName, 'DropRightEvent') if me.InvLeft: left_type = Reference.GiveObjectFlag(me.InvLeft) if not left_type == Reference.OBJ_ITEM: if not left_type == Reference.OBJ_WEAPON and me.InvRight != me.InvLeft: if left_type == Reference.OBJ_STANDARD and me.InvRight != me.InvLeft and left_type == Reference.OBJ_QUIVER and left_type == Reference.OBJ_KEY and left_type == Reference.OBJ_SPECIALKEY and left_type == Reference.OBJ_USEME and left_type == Reference.OBJ_SPECIALKEY or left_type == Reference.OBJ_TABLET: Actions.DropReleaseEventHandler(EntityName, 'DropLeftEvent') def BreakMyShield(EntityName): me = Bladex.GetEntity(EntityName) if me.InvLeft != '': if Breakings.ExplodeSpecialObject(me.InvLeft, 24000.0) == 1: if Reference.EntitiesObjectData.has_key(me.InvLeft): del Reference.EntitiesObjectData[me.InvLeft] DropInvalidObjectsOnImpact(EntityName) me.Wuea = Reference.WUEA_ENDED me.LaunchAnmType('df_s_broken') inv = me.GetInventory() inv.RemoveShield(me.InvLeft) inv.LinkLeftHand('None') if me.Data.NPC: me.Data.ResetCombat(EntityName) def BreakMySword(EntityName): me = Bladex.GetEntity(EntityName) if me.InvRight != '': Actions.Stop_Weapon(EntityName, 'Stop_Weapon') if Breakings.ExplodeSpecialObject(me.InvRight, 24000.0) == 1: if Reference.EntitiesObjectData.has_key(me.InvRight): del Reference.EntitiesObjectData[me.InvRight] DropInvalidObjectsOnImpact(EntityName) me.Wuea = Reference.WUEA_ENDED me.LaunchAnmType('sword_broken') inv = me.GetInventory() inv.RemoveWeapon(me.InvRight) inv.LinkRightHand('None') if me.Data.NPC: me.Data.ResetCombat(EntityName) def StuckWeaponFall(WeaponName, TargetName): weapon = Bladex.GetEntity(WeaponName) if weapon: if weapon.Parent == TargetName: target = Bladex.GetEntity(TargetName) if target: target.Unlink(weapon) if target.Person: weapon.ExcludeHitFor(target) elif target.Parent: parent = Bladex.GetEntity(target.Parent) if parent and parent.Person: weapon.ExcludeHitFor(parent) weapon.Impulse(0.0, 1.0, 0.0) def CalculateFatigue(EntityName, AnimName): me = Bladex.GetEntity(EntityName) if me: current_energy = me.Energy if current_energy > 0.0: charF = 0 animF = 1.0 weaponF = 0 weaponData = None WeaponName = me.GetInventory().GetActiveWeapon() if not not WeaponName: if WeaponName == EntityName and AnimName == 'g_draw_rlx' or AnimName == 'g_draw_run': WeaponName = me.InvRightBack if WeaponName: if Reference.EntitiesObjectData.has_key(WeaponName): if Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_WEAPON or Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_STANDARD: weaponData = Reference.EntitiesObjectData[WeaponName] if len(weaponData) > 1: weaponF = weaponData[1] else: weapon = Bladex.GetEntity(WeaponName) if weapon: kind = weapon.Kind if Reference.DefaultObjectData.has_key(kind): if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON or Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD: weaponData = Reference.DefaultObjectData[kind] if len(weaponData) > 1: weaponF = weaponData[1] if netgame.GetNetState() == 0: charF = CharStats.GetCharDamageData(me.CharType, me.Level) else: charF = NetWeapon.GetDamage(me.CharType, me.Data.NetLevel) me.LaunchAnimation(AnimName) if AnimationData.has_key(me.AnimFullName): animF = AnimationData[me.AnimFullName] elif AnimationData.has_key(me.AnimName): animF = AnimationData[me.AnimName] lvl = me.Level + 1 energy_cost = max((charF + weaponF) * animF, 0.0) + me.Data.Energy2Lose max_energy = CharStats.GetCharMaxEnergy(me.Kind, me.Level) me.Data.LoseEnergyRate = 0.0 if PrintFatigue: print 'energy_cost= (charF(' + `charF` + ') + weaponF(' + `weaponF` + ')) * (animF(' + me.AnimFullName + '=' + `animF` + ') + prev_energy2lose(' + `me.Data.Energy2Lose` + ')= ' + `energy_cost` print 'max_energy= ' + `max_energy` + ', current_energy= ' + `me.Energy` if energy_cost < max_energy: me.Data.Energy2Lose = energy_cost if energy_cost > me.Energy: weapon = Bladex.GetEntity(me.GetInventory().GetActiveWeapon()) if weapon and not (weapon.Person): weapon_flag = Reference.GiveWeaponFlag(WeaponName) if weapon_flag == Reference.W_FLAG_2W: clumsy_anm = 'g_bad_sword' elif weapon_flag == Reference.W_FLAG_AXE: clumsy_anm = 'g_bad_axe' elif weapon_flag == Reference.W_FLAG_SP: clumsy_anm = 'g_bad_spear' else: clumsy_anm = 'g_bad_1h' else: clumsy_anm = 'g_bad_no' me.Wuea = Reference.WUEA_ENDED me.LaunchAnmType(clumsy_anm) Actions.ReportMsg('You need more energy for this attack') try: anim_duration = Bladex.GetAnimationDuration(me.AnimFullName) except RuntimeError: print me.AnimFullName + ' has not been defined for character ' + me.Kind anim_duration = 0.3 if anim_duration > 0.0: me.Data.LoseEnergyRate = energy_cost / anim_duration else: me.Data.LoseEnergyRate = 0.0 return 1 else: Actions.ReportMsg('You need more energy for this attack') me.Wuea = Reference.WUEA_ENDED me.InterruptCombat() me.RaiseEvent('Interrupt') return 1 return 0 def CheckRightHandToDrop(EntityName): me = Bladex.GetEntity(EntityName) if not (me.InvRight): return None two_handed_on_right = 0 if Actions.IsRightHandWeaponObject(EntityName): w_flag = Reference.GiveWeaponFlag(me.InvRight) if w_flag != Reference.W_FLAG_1H: two_handed_on_right = 1 special_to_drop = 0 flag = Reference.GiveObjectFlag(me.InvRight) if flag == Reference.OBJ_KEY and flag == Reference.OBJ_SPECIALKEY or flag == Reference.OBJ_USEME: print 'right 2 drop' special_to_drop = 1 if special_to_drop == 1 and two_handed_on_right and me.InvLeft and me.InvRight != me.InvLeft: if Actions.TryDropRight(EntityName): Actions.DropReleaseEventHandler(EntityName, 'DropRightEvent') if me.InvRight: return FALSE def CalculateDamage(VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded): CheckRightHandToDrop(VictimName) charF = 0 animF = 1.0 weaponF = 0 randomF = 0 throwF = 0 shieldF = 0 bowF = 0 locationF = 1.0 magicF = 1.0 thrown_flag = 0 weaponData = None if WeaponName: if Reference.EntitiesObjectData.has_key(WeaponName): if Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_WEAPON and Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_STANDARD or Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_ARROW: weaponData = Reference.EntitiesObjectData[WeaponName] if len(weaponData) > 1: weaponF = weaponData[1] else: kind = Bladex.GetEntity(WeaponName).Kind if Reference.DefaultObjectData.has_key(kind): if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON and Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD or Reference.DefaultObjectData[kind][0] == Reference.OBJ_ARROW: weaponData = Reference.DefaultObjectData[kind] if len(weaponData) > 1: weaponF = weaponData[1] if not AttackerName and weaponData and len(weaponData) > 2: if PrintFormula == 1: print 'Possible thrown weapon' weapon = Bladex.GetEntity(WeaponName) if weapon: try: if weapon.Data and weapon.Data.ThrownBy: AttackerName = weapon.Data.ThrownBy.Name thrown_flag = 1 if len(weaponData) > 3: throwF = weaponData[3] except AttributeError: if weapon.Arrow: thrown_flag = 1 if len(weaponData) > 3: throwF = weaponData[3] except: weapon.Arrow try: if weapon.Person: AttackerName = WeaponName except: pass attacker = None if AttackerName: attacker = Bladex.GetEntity(AttackerName) if attacker and attacker.Person: magicF = attacker.Data.FAttack if DamageType == 'Impale' and DamageType == 'Slash' or DamageType == 'Crush': if netgame.GetNetState() == 0: charF = CharStats.GetCharDamageData(attacker.CharType, attacker.Level) else: charF = NetWeapon.GetDamage(attacker.CharType, attacker.Data.NetLevel) if not thrown_flag: if AnimationData.has_key(attacker.AnimFullName): animF = AnimationData[attacker.AnimFullName] elif AnimationData.has_key(attacker.AnimName): animF = AnimationData[attacker.AnimName] randomF = round(whrandom.uniform(-0.05, 0.05) * charF) charF = max(charF + randomF, 0) if DamageZone == Reference.BODY_HEAD and DamageType == 'Impale' and thrown_flag and weaponData[0] == Reference.OBJ_ARROW: locationF = 4.0 if AttackerName: shieldName = attacker.GetInventory().GetActiveShield() if shieldName and not thrown_flag: if Reference.EntitiesObjectData.has_key(shieldName): if Reference.EntitiesObjectData[shieldName][0] == Reference.OBJ_SHIELD: shieldF = Reference.EntitiesObjectData[shieldName][1] else: kind = Bladex.GetEntity(shieldName).Kind if Reference.DefaultObjectData.has_key(kind): if Reference.DefaultObjectData[kind][0] == Reference.OBJ_SHIELD: shieldF = Reference.DefaultObjectData[kind][1] if AttackerName and attacker and attacker.GetInventory().HoldingBow and thrown_flag: if Reference.EntitiesObjectData.has_key(attacker.InvLeft): if Reference.EntitiesObjectData[attacker.InvLeft][0] == Reference.OBJ_BOW: bowF = Reference.EntitiesObjectData[attacker.InvLeft][1] else: kind = Bladex.GetEntity(attacker.InvLeft).Kind if Reference.DefaultObjectData.has_key(kind): if Reference.DefaultObjectData[kind][0] == Reference.OBJ_BOW: bowF = Reference.DefaultObjectData[kind][1] if AttackerName and attacker and attacker.Person: lvl = attacker.Level + 1 else: lvl = 0 basic_damage = (charF * magicF * locationF + weaponF + throwF + bowF + shieldF) * animF basic_damage = max(basic_damage, 0) if PrintFormula == 1: print 'Basic Damage Formula= ((charF * magicF * locationF) + weaponF + throwF + bowF + shieldF) * animF' print 'Basic Damage = (( ' + `charF` + ' * ' + `magicF` + ' * ' + `locationF` + ' ) + ' + `weaponF` + ' + ' + `throwF` + ' + ' + `bowF` + ' + ' + `shieldF` + ') * ' + `animF` + ' = ' + `basic_damage` me = Bladex.GetEntity(VictimName) charF = 0 shieldF = 0 weaponF = 0 magicF = me.Data.FDefense randomF = 0 shield_breakable = 0 victimsShieldData = None blocking_with_weapon = 0 if Shielded: victimsShieldName = me.GetInventory().GetActiveShield() if victimsShieldName: if Reference.EntitiesObjectData.has_key(victimsShieldName): if Reference.EntitiesObjectData[victimsShieldName][0] == Reference.OBJ_SHIELD: victimsShieldData = Reference.EntitiesObjectData[victimsShieldName] shieldF = victimsShieldData[2] shield_breakable = victimsShieldData[7] else: kind = Bladex.GetEntity(victimsShieldName).Kind if Reference.DefaultObjectData.has_key(kind): if Reference.DefaultObjectData[kind][0] == Reference.OBJ_SHIELD: victimsShieldData = Reference.DefaultObjectData[kind] shieldF = Reference.DefaultObjectData[kind][2] shield_breakable = Reference.DefaultObjectData[kind][7] else: victimsWeaponName = me.InvRight if not victimsWeaponName and victimsWeaponName == '' or victimsWeaponName == 'None': print 'Unexpected error in CalculateDamage' print 'Blocking but nothing in hands?' return None w_weapon = Bladex.GetEntity(victimsWeaponName) w_flag = Reference.GiveObjectFlag(victimsWeaponName) if w_flag != Reference.OBJ_WEAPON: print 'Error in CalculateDamage' print 'Blocking with an unexpected type of weapon' return None if Reference.EntitiesObjectData.has_key(victimsWeaponName): victimsShieldData = Reference.EntitiesObjectData[victimsWeaponName] else: kind = Bladex.GetEntity(victimsWeaponName).Kind if Reference.DefaultObjectData.has_key(kind): victimsShieldData = Reference.DefaultObjectData[kind] if not victimsShieldData and len(victimsShieldData[5]) < 1 or victimsShieldData[5][0] == Reference.W_FLAG_1H: print 'Error in CalculateDamage' print 'Trying to wblock with a one handed weapon!' else: shieldF = victimsShieldData[5][4] shield_breakable = victimsShieldData[5][5] blocking_with_weapon = 1 if netgame.GetNetState() == 0: charF = CharStats.GetCharDefenseData(me.CharType, me.Level) + me.Data.armour_prot_factor else: charF = NetWeapon.GetDefense(me.CharType, me.Data.NetLevel) randomF = round(whrandom.uniform(-0.05, 0.05) * charF) charF = max(charF + randomF, 0) victimsWeaponData = None if me.GetInventory().HoldingBow: victimsWeaponName = me.InvLeft else: victimsWeaponName = me.InvRight if victimsWeaponName and blocking_with_weapon == 0: if Reference.EntitiesObjectData.has_key(victimsWeaponName): if Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_WEAPON and Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_STANDARD and Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_ARROW or Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_BOW: victimsWeaponData = Reference.EntitiesObjectData[victimsWeaponName] if len(victimsWeaponData) > 2: weaponF = victimsWeaponData[2] else: kind = Bladex.GetEntity(victimsWeaponName).Kind if Reference.DefaultObjectData.has_key(kind): if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON and Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD and Reference.DefaultObjectData[kind][0] == Reference.OBJ_ARROW or Reference.DefaultObjectData[kind][0] == Reference.OBJ_BOW: victimsWeaponData = Reference.DefaultObjectData[kind] if len(victimsWeaponData) > 2: weaponF = victimsWeaponData[2] DEF = charF * magicF + shieldF + weaponF effective_damage = basic_damage - DEF effective_damage = max(effective_damage, 0) if PrintFormula == 1: print 'Effective Damage Formula = basic_damage - (charF * magicF) - shieldF - weaponF' print 'Effective Damage Formula = ' + `basic_damage` + ' - ( ' + `charF` + ' * ' + `magicF` + ' ) - ' + `shieldF` + ' - ' + `weaponF` + ' = ' + `effective_damage` if Shielded: damage_withstood = int(max(basic_damage - DEF - shieldF, 0)) if not blocking_with_weapon: shield = Bladex.GetEntity(me.GetInventory().GetActiveShield()) try: if shield and shield_breakable: if victimsShieldData: if not Reference.EntitiesObjectData.has_key(shield.Name): Reference.EntitiesObjectData[shield.Name] = copy.copy(victimsShieldData) victimsShieldData = Reference.EntitiesObjectData[shield.Name] victimsShieldData[2] = victimsShieldData[2] - damage_withstood if victimsShieldData[2] <= 0.0: victimsShieldData[2] = 0.0 if shield.Data.brkobjdata: BreakMyShield(me.Name) Shielded = 0 elif attacker and attacker.InDestructorAttack == 1 and damage_withstood > shield_breakable: if shield.Data.brkobjdata: BreakMyShield(me.Name) Shielded = 0 if PrintFormula == 1: print 'Shield Breaking in destructor attack, took: ' + `damage_withstood` + ', max: ' + `shield_breakable` elif not thrown_flag and attacker and attacker.Person and attacker.GotAnmType('sw_react'): attacker.Wuea = Reference.WUEA_ENDED attacker.LaunchAnmType('sw_react') except AttributeError: pass try: if shield and shield.Data and shield.Data.AbsorbFunc: shield.Data.AbsorbFunc(AttackerName, WeaponName, damage_withstood) except AttributeError: pass else: weapon = Bladex.GetEntity(me.GetInventory().GetActiveWeapon()) try: if weapon and weapon.Data.brkobjdata: if victimsShieldData: if not Reference.EntitiesObjectData.has_key(weapon.Name): Reference.EntitiesObjectData[weapon.Name] = copy.copy(victimsShieldData) victimsShieldData = Reference.EntitiesObjectData[weapon.Name] victimsShieldData[5][4] = victimsShieldData[5][4] - damage_withstood if victimsShieldData[5][4] <= 0.0: victimsShieldData[5][4] = 0.0 if weapon.Data.brkobjdata: BreakMySword(me.Name) Shielded = 0 elif attacker and attacker.InDestructorAttack == 1 and damage_withstood > shield_breakable: if weapon.Data.brkobjdata: BreakMySword(me.Name) Shielded = 0 if PrintFormula == 1: print 'Weapon Breaking in destructor attack, took: ' + `damage_withstood` + ', max: ' + `shield_breakable` except AttributeError: pass try: if weapon and weapon.Data and weapon.Data.AbsorbFunc: weapon.Data.AbsorbFunc(AttackerName, WeaponName, damage_withstood) except AttributeError: pass damage_resistance = me.Data.GetResistance(DamageType) if damage_resistance > 0.0: if PrintFormula == 1: print 'Resistance to ' + DamageType + ' at ' + `damage_resistance` + ' reduces the effective_damage to ' + `effective_damage * (1.0 - damage_resistance)` effective_damage = effective_damage * (1.0 - damage_resistance) special_damage = 0.0 if Shielded: pass if not (effective_damage <= 0): effective_damage = effective_damage + special_damage if not Shielded: if (DamageType == 'Impale' or DamageType == 'Slash') and Bladex.GetBloodLevel() > 0: me.Data.TakeBleedingImpact = effective_damage else: me.Data.TakeBleedingImpact = 0 prevLife = me.Life if not (me.Data.Invincibility): me.Life = me.Life - effective_damage if effective_damage > 0: if me.Life <= 0: pass me.Data.Mutilate = DamageType == 'Slash' else: me.Data.Mutilate = 0 if not Shielded: effective_damage = 1.0 if thrown_flag == 1: try: me.Data.Respond2Thrown(me.Name, AttackerName) except AttributeError: pass me.Data.RespondToHit(me.Name, AttackerName, effective_damage, DamageZone, Shielded) if PlayerHitFunc != '': PlayerHitFunc(VictimName, AttackerName, me.Life, prevLife) if me.Life <= 0.0: if AttackerName: attacker = Bladex.GetEntity(AttackerName) if attacker and attacker.InDestructorAttack == 1 and effective_damage > 1: try: if victimsShieldName: victimsShield = Bladex.GetEntity(victimsShieldName) if victimsShield and victimsShield.Data.brkobjdata: BreakMyShield(me.Name) except: pass try: if victimsWeaponName: victimsWeapon = Bladex.GetEntity(victimsWeaponName) if victimsWeapon and victimsWeaponName.Data.brkobjdata: BreakMySword(me.Name) except: pass if prevLife > 0 and netgame.GetNetState() == 0: AttackerEntity = Bladex.GetEntity(AttackerName) if AttackerEntity: AttackerEntity.Data.OnKilledEnemy(VictimName) if thrown_flag and weapon.Arrow: weapon.MessageEvent(Reference.MESSAGE_STOP_WEAPON, 0, 0) weapon.Stop() if me and not (me.Data.Mutilate) and DamageNode != -1 and DamageZone != Reference.BODY_HEAD and me.Life > 0.0: me.LinkToNode(weapon, DamageNode) sticktime = 3.0 / weapon.Mass print 'object ' + weapon.Name + ' of kind ' + weapon.Kind + ' of mass ' + `weapon.Mass` + ' sticking for ' + `sticktime` + ' seconds' Bladex.AddScheduledFunc(Bladex.GetTime() + sticktime, StuckWeaponFall, (weapon.Name, VictimName), weapon.Name + '_StuckWeaponFall') if weapon.StickFunc: weapon.StickFunc(weapon.Name, me.Name) else: weapon.Impulse(0.0, 1.0, 0.0) if me.Data.Mutilate: if PrintFormula == 1: print 'Mutilation' if Bladex.GetMutilationLevel() == 0: return 0 else: return me.Data.Mutilate