Index: src/map/battleutils.cpp =================================================================== --- src/map/battleutils.cpp (revision 3776) +++ src/map/battleutils.cpp (working copy) @@ -1099,7 +1099,7 @@ Samba -= lvlDiff; if (Samba > (finaldamage / 2)){ - Samba = finaldamage / 2; + Samba = finaldamage / 2; } if(finaldamage <= 2){ @@ -1144,33 +1144,1010 @@ // no enspells active, check weapon additional effects CItemWeapon* PWeapon = (CItemWeapon*)PAttacker->getStorage(LOC_INVENTORY)->GetItem(PAttacker->equip[SLOT_MAIN]); - + CItemWeapon* PAmmo = (CItemWeapon*)PAttacker->getStorage(LOC_INVENTORY)->GetItem(PAttacker->equip[SLOT_AMMO]); + int ammoUse = 0; + int tizonaChance = 0; + int tizonaPercent = 0; + if (Action->animation == 1) PWeapon = (CItemWeapon*)PAttacker->getStorage(LOC_INVENTORY)->GetItem(PAttacker->equip[SLOT_SUB]); if(PWeapon != NULL) { EFFECT dispelled; + uint8 chance = 0; + uint8 effect = 0; switch(PWeapon->getID()) { - //Additional Effect: HP drain Weapons - case 16827: - case 16528: - case 16824: - case 17651: - case 16556: - case 16609: - case 16580: - case 17646: - case 16777: - case 16791: - case 16846: - case 16881: - case 17561: - case 17562: - case 17778: - case 17779: - case 17576: - case 17510: + // Additional Effect vs. Vermin: HP Drain + case 18428: // Kogitsunemaru + if(PDefender->m_EcoSystem == SYSTEM_VERMIN) + { + effect = 1; + } + return; + //Additional Effect: HP Drain Weapons + case 16827: // Carnage Blade + case 16528: // Bloody Rapier + case 16824: // Carnage Rapier + case 17651: // Dainslaif + case 16556: // Bloody Blade + case 16609: // Bloody Sword + case 16580: // Bloodsword + case 17646: // Carnage Sword + case 16777: // Death Scythe + case 16791: // Death Scythe +1 + case 16846: // Bloody Lance + case 16881: // Carnage Lance + case 17561: // Revenging Staff + case 17562: // Revenging Staff +1 + case 17778: // Muketsu + case 17779: // Muketsu +1 + case 17576: // Grim Staff + case 17510: // Vampiric Claws + case 18810: // Cadushi Grip + case 16582: // Vetala Sword + case 18859: // Kerykeion + case 18785: // Grotesque Cesti + case 18908: // Dhampyr Sword + case 18856: // Deae Gratia + { + effect = 1; + } + break; + + //Additional Effect: MP Recover + case 18324: // Mjollnir Lvl 75 + case 18325: // Mjollnir Lvl 80 + case 18647: // Mjollnir Lvl 85 + case 18661: // Mjollnir Lvl 90 + case 18675: // Mjollnir Lvl 95 + case 19756: // Mjollnir Lvl 99 + case 19849: // Mjollnir Lvl 99 - 2 + { + effect = 2; + } + break; + + //Additional Effect: TP drain Weapons + case 18904: // Ephemeron + case 19795: // Ereptor Lance + case 19160: // Estramacon + case 18437: // Namikirimaru + case 17823: // Shinsoku + { + effect = 3; + } + break; + + //Additional Effect: MP drain Weapons + case 17574: // Archalaus's Pole + case 16509: // Aspir Knife + case 18948: // Enforcer + case 17430: // Fey Wand + case 18047: // Havoc Scythe + case 17718: // Leech Scimitar + case 18941: // Naigama + case 18942: // Naigama +1 + case 18599: // Pestle + { + chance = 10; + effect = 4; + } + break; + case 17072: // Lilith's Rod + { + chance = 20; + chance += rand()%11; + effect = 4; + } + break; + + //Additional Effect: HP or MP drain Weapons + case 17745: // Hofud + { + effect = 5; + } + break; + + //Additional Effect: HP, MP, or TP drain Weapons + case 19132: // Twilight Knife + { + if (rand()%100 <= 30) + { + int randomEffect = rand()%3; + if (randomEffect == 0) + { + effect =1; + } + else if (randomEffect == 1) + { + chance = 100; + effect = 4; + } + else + { + effect = 3; + } + } + } + break; + // Additional Effect vs. Vermin: Stun + case 18040: // Webcutter + if(PDefender->m_EcoSystem == SYSTEM_VERMIN) + { + effect = 6; + } + break; + //Additional Effect: Stun Weapons (5% chance guestimate) + case 19177: // Etourdissante + case 19178: // Etourdissante +1 + case 16910: // Mamushito + case 17770: // Mamushito +1 + case 19019: // Platinum Grip + case 19020: // Platinum Grip +1 + case 17464: // Purgatory Mace + case 16431: // Stun Claws + case 17486: // Stun Claws +1 + case 16432: // Stun Jamadhars + case 17484: // Stun Jamadhars +1 + case 16503: // Stun Knife + case 17600: // Stun Knife +1 + case 16506: // Stun Kukri + case 17614: // Stun Kukri +1 + { + effect = 6; + } + break; + + // Additional Effect vs. Tigers: Paralysis + case 16672: // Tigerhunter + if(((CMobEntity*)PDefender)->m_Family == 242) + { + effect = 7; + } + break; + //Additional Effect: Paralysis Weapons (5% chance guestimate) + case 17737: // Corsair's Scimitar + case 18762: // Custodes + case 17648: // Dragvandil + case 18211: // Gawain's Axe + case 18312: // Kikoku Lvl 75 + case 18313: // Kikoku Lvl 80 + case 18645: // Kikoku Lvl 85 + case 18659: // Kikoku Lvl 90 + case 18673: // Kikoku Lvl 95 + case 19754: // Kikoku Lvl 99 + case 19847: // Kikoku Lvl 99 - 2 + case 19796: // Rosschinder + case 19797: // Rosschinder +1 + case 17492: // Shiva's Claws + { + effect = 7; + } + break; + + // Additional Effect: Petrify (5% chance guestimate) + case 18454: // Ishikirimaru + { + effect = 8; + } + break; + + // Additional Effect: Terror (5% chance guestimate) + case 19163: // Nightfall + { + effect = 9; + } + break; + + // Additional Effect: Addle (5% chance guestimate) + case 19316: // Fetter Lance + { + effect = 10; + } + break; + + // Additional Effect: Choke (5% chance guestimate) + case 18288: // Guttler Lvl 75 + case 18289: // Guttler Lvl 80 + case 18641: // Guttler Lvl 85 + case 18655: // Guttler Lvl 90 + case 18669: // Guttler Lvl 95 + case 19750: // Guttler Lvl 99 + case 19843: // Guttler Lvl 99 - 2 + { + effect = 11; + } + break; + + // Additional Effect vs. Plantoids: Weight + case 16785: // Harvester + if(PDefender->m_EcoSystem == SYSTEM_PLANTOID) + { + effect = 12; + } + break; + // Additional Effect: Weight (5% chance guestimate) + case 18096: // Heavy Lance + case 18026: // Magnet Knife + case 19140: // Mantodea Harpe + { + effect = 12; + } + break; + + // Additional Effect: Amnesia (5% chance guestimate) + case 18510: // Vermeil Bhuj + { + effect = 13; + } + break; + + // Additional Effect vs. Plantoids: Bind + case 16783: // Plantreaper + if(PDefender->m_EcoSystem == SYSTEM_PLANTOID) + { + effect = 14; + } + break; + // Additional Effect vs. Birds: Bind + case 18044: // Scarecrow Scythe + if(PDefender->m_EcoSystem == SYSTEM_BIRD) + { + effect = 14; + } + break; + // Additional Effect vs. Arcana: Bind + case 17058: // Caduceus + if(PDefender->m_EcoSystem == SYSTEM_ARCANA) + { + effect = 14; + } + break; + // Additional Effect: Bind (5% chance guestimate) + case 16897: // Kageboshi + { + effect = 14; + } + break; + + // Additional Effect: Slow (5% chance guestimate) + case 17083: // Time Hammer + { + effect = 15; + } + break; + + // Additional Effect: Flash (5% chance guestimate) + case 17069: // Moepapa Mace + { + effect = 16; + } + break; + + // Additional Effect: Reduce Enemy TP (2% chance guestimate) + case 19298: // Ikarigiri + { + effect = 17; + } + break; + + // Additional Effect: STR Boost 10% ?? + case 17563: // Power Staff + { + effect = 18; + } + break; + + // Additional Effect: Haste (7% chance guestimate) + case 16504: // Oynos Knife + { + effect = 19; + } + break; + + // Additional Effect: Blink (15% chance guestimate) + case 18830: // Gusterion + { + effect = 20; + } + break; + + //Additional Effect: Poison Weapons (5% chance guestimate) + case 16907: // Busuto + case 16927: // Busuto +1 + case 16525: // Hornet Fleuret + case 16909: // Kororito + case 17769: // Kororito +1 + case 17937: // Leopard Axe + case 18270: // Mandau Lvl 75 + case 18271: // Mandau Lvl 80 + case 18638: // Mandau Lvl 85 + case 18652: // Mandau Lvl 90 + case 18666: // Mandau Lvl 95 + case 19747: // Mandau Lvl 99 + case 19840: // Mandau Lvl 99 - 2 + case 17650: // Nadrs + case 16458: // Poison Baselard + case 16387: // Poison Cesti + case 16700: // Poison Cesti +1 + case 16417: // Poison Claws + case 16439: // Poison Claws +1 + case 16496: // Poison Dagger + case 16741: // Poison Dagger +1 + case 16403: // Poison Katars + case 16693: // Poison Katars +1 + case 16472: // Poison Knife + case 16742: // Poison Knife +1 + case 16478: // Poison Kukri + case 16488: // Poison Kukri +1 + case 16410: // Poison Baghnakhs + case 16692: // Poison Baghnakhs +1 + case 16743: // Python Baselard + case 16507: // Venom Baselard + case 16510: // Venom Baselard +1 + case 16418: // Venom Claws + case 16425: // Venom Claws +1 + case 16404: // Venom Katars + case 17483: // Venom Katars +1 + case 16502: // Venom Knife + case 16762: // Venom Knife +1 + case 16499: // Venom Kris + case 16761: // Venom Kris +1 + case 16505: // Venom Kukri + case 17604: // Venom Kukri +1 + case 17959: // Viperine Pick + case 17634: // Wasp Fleuret + { + effect = 21; + } + break; + + // Additional Effect: Poisone, Paralysis, or Bind (5% chance guestimate) + case 18784: // Metasoma Katars + if (rand()%100 <= 5) + { + int metasomaEffect = rand()%3; + if (metasomaEffect == 0) + { + effect = 21; + } + else if (metasomaEffect == 1) + { + effect = 7; + } + else + { + effect = 14; + } + } + break; + + // Additional Effect: Blind (5% chance guestimate) + case 18306: // Apocalypse Lvl 75 + case 18307: // Apocalypse Lvl 80 + case 18644: // Apocalypse Lvl 85 + case 18658: // Apocalypse Lvl 90 + case 18672: // Apocalypse Lvl 95 + case 19753: // Apocalypse Lvl 99 - 1 + case 19846: // Apocalypse Lvl 99 - 2 + case 16454: // Blind Dagger + case 16493: // Blind Dagger +1 + case 16471: // Blind Knife + case 16490: // Blind Knife +1 + case 16905: // Bokuto + case 16926: // Bokuto +1 + { + effect = 22; + } + break; + + // Additional Effect: Silence (5% chance guestimate) + case 17627: // Garuda's Dagger + case 18355: // Hushed Baghnakhs + case 18008: // Hushed Dagger + case 16906: // Mokuto + case 16925: // Mokuto +1 + case 17797: // Seito + case 16495: // Silence Dagger + case 16508: // Silence Dagger +1 + case 16429: // Silence Baghnakhs + case 16438: // Silence Baghnakhs +1 + { + effect = 23; + } + break; + + // Additional Effect: Curse (5% chance guestimate) + case 16533: // Ancient Sword + case 17116: // Misery Staff + case 18813: // Ultio Grip + { + effect = 24; + } + break; + + // Additional Effect: Death (2% chance guestimate) + case 18916: // Heimdall's Doom + case 18551: // Twilight Scythe + { + effect = 25; + } + break; + + // Additional Effect: Sleep (5% chance guestimate) + case 17117: // Hypno Staff + case 16497: // Sleep Dagger + case 17575: // Somnus Signa + { + effect = 26; + } + break; + + + // Additional Effect: Impairs Evasion (5% chance guestimate) + case 18032: // Adder Jambiya + case 18033: // Adder Jambiya +1 + case 17695: // Bayard's Sword + case 18294: // Bravura Lvl 75 + case 18295: // Bravura Lvl 80 + case 18642: // Bravura Lvl 85 + case 18656: // Bravura Lvl 90 + case 18670: // Bravura Lvl 95 + case 19751: // Bravura Lvl 99 + case 19844: // Bravura Lvl 99 - 2 + case 16773: // Cruel Scythe + case 16863: // Cruel Spear + case 18118: // Dark Mezraq + case 18119: // Dark Mezraq +1 + case 16974: // Dotanuki + case 18110: // Mezraq + case 18111: // Mezraq +1 + case 18123: // Thalassocrat + case 18124: // Thalassocrat +1 + { + effect = 27; + } + break; + + // Additional Effect vs. Dolls: Weakens Defense + case 16674: // Emeth Pick + if((((CMobEntity*)PDefender)->m_Family == 83) || ((CMobEntity*)PDefender)->m_Family == 84 + || ((CMobEntity*)PDefender)->m_Family == 85) + { + effect = 28; + } + break; + + // Additional Effect vs. Arcana Weakens Defense + case 17416: // Arcana Breaker + if(PDefender->m_EcoSystem == SYSTEM_ARCANA) + { + effect = 28; + } + break; + + // Additional Effect Weakens Defense + case 16430: // Acid Claws + case 16459: // Acid Baselard + case 17605: // Acid Dagger + case 16501: // Acid Knife + case 16479: // Acid Kukri + case 18794: // Blutklauen + case 18793: // Blutkrallen + case 17487: // Corrosive Claws + case 17607: // Corrosive Baselard + case 17606: // Corrosive Dagger + case 17608: // Corrosive Knife + case 16494: // Corrosive Kukri + case 17694: // Guespiere + case 18300: // Gungnir Lvl 75 + case 18301: // Gungnir Lvl 80 + case 18643: // Gungnir Lvl 85 + case 18657: // Gungnir Lvl 90 + case 18671: // Gungnir Lvl 95 + case 19752: // Gungnir Lvl 99 + case 19845: // Gungnir Lvl 99 - 2 + case 18357: // Melt Claws + case 18012: // Melt Baselard + case 18010: // Melt Dagger + case 18011: // Melt Knife + case 18013: // Melt Kukri + case 18410: // Melt Katana + case 20639: // Oxidant Baselard + case 20640: // Nitric Baselard + case 21009: // Nakajimarai + case 21010: // Nakajimarai +1 + case 17106: // Rockmasher + case 16908: // Yoto + case 17768: // Yoto +1 + { + effect = 28; + } + break; + + // Additional Effect: Weakens Attacks 5% ?? + case 18318: // Amanomurakumo Lvl 75 + case 18319: // Amanomurakumo Lvl 80 + case 18646: // Amanomurakumo Lvl 85 + case 18660: // Amanomurakumo Lvl 90 + case 18674: // Amanomurakumo Lvl 95 + case 19775: // Amanomurakumo Lvl 99 + case 19848: // Amanomurakumo Lvl 99 - 2 + case 18088: // Dreizack + { + effect = 29; + } + break; + + // Additional Effect vs. Beasts: Darkness Damage + case 18041: // A L'Outrance + if(PDefender->m_EcoSystem == SYSTEM_BEAST) + { + chance = 100; + effect = 30; + } + break; + // Additional Effect: Darkness Damage (5% chance guestimate) + case 18961: // Plaga Scythe + case 16515: // Colichemarde + case 17632: // Colichemarde +1 + case 16787: // Demon Slicer + case 17559: // Dark Staff + case 17560: // Pluto's Staff + case 16936: // Demonic Sword + { + chance = 5; + effect = 30; + } + break; + + // Additional Effect: Earth Damage (5% chance guestimate) + case 17552: // Terra Staff + case 18501: // Seismic Axe + case 17807: // Gold Musketeers Uchigatana + case 19114: // Galkan Dagger + case 17076: // Earth Wand + case 17551: // Earth Staff + case 17438: // Titan's Cudgel + { + effect = 31; + } + break; + + // Additional Effect vs. Undead: Fire Damage + case 18042: // Ascention + if(PDefender->m_EcoSystem == SYSTEM_UNDEAD) + { + effect = 32; + } + break; + // Additional Effect vs. Plantoids: Fire Damage + case 16720: // Plantbane + if(PDefender->m_EcoSystem == SYSTEM_PLANTOID) + { + effect = 32; + } + break; + // Additional Effect: Fire Damage (5% chance guestimate) + case 18385: // Agol + case 19151: // Bahdur + case 19152: // Bahdur +1 + case 19296: // Ban + case 16398: // Burning Cesti + case 16929: // Burning Claymore + case 16416: // Dragon Claws + case 17485: // Dragon Claws +1 + case 17545: // Fire Staff + case 16543: // Fire Sword + case 16564: // Flame Blade + case 16804: // Flame Blade +1 + case 16588: // Flame Claymore + case 16522: // Flame Degen + case 16823: // Flame Degen +1 + case 16621: // Flame Sword + case 18625: // Gerra's Staff + case 16713: // Hellfire Axe + case 16928: // Hellfire Sword + case 16973: // Homura + case 16986: // Homura +1 + case 17665: // Ifrit's Blade + case 16709: // Inferno Axe + case 16594: // Inferno Sword + case 17828: // Koen + case 18220: // Prominence Axe + case 18381: // Prominence Sword + case 18043: // Suzaku's Scythe + case 17706: // Vulcan Blade + case 18379: // Vulcan Claymore + case 17705: // Vulcan Degen + case 17704: // Vulcan Sword + case 17546: // Vulcan's Staff + { + effect = 32; + } + break; + + // Additional Effect vs. Slimes: Light Damage + case 17981: // Ban Del Sol + if((((CMobEntity*)PDefender)->m_Family == 228) || ((CMobEntity*)PDefender)->m_Family == 229 + || ((CMobEntity*)PDefender)->m_Family == 230) + { + effect = 33; + } + break; + // Additional Effect vs. Orcs: Light Damage + case 16867: // Orc Piercer + if((((CMobEntity*)PDefender)->m_Family == 189) || ((CMobEntity*)PDefender)->m_Family == 190 + || ((CMobEntity*)PDefender)->m_Family == 248 || ((CMobEntity*)PDefender)->m_Family == 334) + { + effect = 33; + } + break; + // Additional Effect vs. Gigas: Light Damage + case 16956: // Skofnung + if(((((CMobEntity*)PDefender)->m_Family >= 126) && (((CMobEntity*)PDefender)->m_Family <= 130)) + || ((CMobEntity*)PDefender)->m_Family == 328) + { + chance = 100; + effect = 33; + } + break; + // Additional Effect vs. Dragons: Light Damage + case 16943: // Ascalon + if(PDefender->m_EcoSystem == SYSTEM_DRAGON) + { + chance = 100; + effect = 33; + } + break; + // Additional Effect Night Time: Light Damage + case 17774: // Shiranui + if(CVanaTime::getInstance()->GetCurrentTOTD() == TIME_NIGHT) + { + chance = 20; + effect = 33; + } + break; + // Additional Effect: Light Damage (5% chance guestimate) + case 17558: // Apollo's Staff + case 18882: // Beaivi's Scepter + case 16549: // Divine Sword + case 16826: // Divine Sword +1 + case 16938: // Glorious Sword + case 16550: // Hallowed Sword + case 17738: // Hauteclaire + case 16523: // Holy Degen + case 16817: // Holy Degen +1 + case 16860: // Holy Lance + case 16880: // Holy Lance +1 + case 17041: // Holy Mace + case 17411: // Holy Mace +1 + case 17080: // Holy Maul + case 17114: // Holy Maul +1 + case 16581: // Holy Sword + case 16816: // Holy Sword +1 + case 17085: // Holy Wand + case 17434: // Holy Wand +1 + case 17557: // Light Staff + case 17414: // Pixie Mace + case 17683: // Sacred Degen + case 16858: // Sacred Lance + case 18391: // Sacred Mace + case 18392: // Sacred Maul + case 17682: // Sacred Sword + case 18393: // Sacred Wand + case 18853: // Spirit Maul + case 16613: // Spirit Sword + { + chance = 5; + effect = 33; + } + break; + + // Additional Effect vs. Undead: Water Damage + case 16884: // Narval + if(PDefender->m_EcoSystem == SYSTEM_UNDEAD) + { + effect = 34; + } + break; + // Additional Effect: Water Damage with Pump + case 17512: // Hydro Baghnakhs + case 17513: // Hydro Baghnakhs +1 + case 18200: // Hydro Axe + case 18201: // Hydro Baghnakhs +1 + case 18204: // Hydro Chopper + case 18205: // Hydro Chopper +1 + case 17514: // Hydro Claws + case 17515: // Hydro Claws +1 + case 18202: // Hydro Cutter + case 18203: // Hydro Cutter +1 + case 17516: // Hydro Patas + case 17517: // Hydro Patas +1 + if (PAmmo->getID() == 18232 || PAmmo->getID() == 18233 || PAmmo->getID() == 18234) + { + chance = 10; + chance += rand()%6; + ammoUse = 1; + effect = 36; + } + break; + + // Additional Effect: Water Damage (5% chance guestimate) + case 17750: // Anthos Xiphos + case 16945: // Arondight + case 18953: // Beluga + case 17623: // Bmt. Knife + case 16548: // Coral Sword + case 17134: // Dolphin Staff + case 18109: // Leviathan's Couse + case 17439: // Leviathan's Rod + case 16620: // Merman's Sword + case 16961: // Murasame + case 17556: // Neptune's Staff + case 17659: // Seiryu's Sword + case 17555: // Water Staff + case 17533: // Whale Staff + case 17534: // Whale Staff +1 + { + chance = 5; + effect = 34; + } + break; + + // Additional Effect vs. Lizards: Ice Damage + case 16853: // Lizard Piercer + if(PDefender->m_EcoSystem == SYSTEM_LIZARD) + { + effect = 35; + } + break; + // Additional Effect vs. Hounds + case 18199: // Ulfhedinn Axe + if(((CMobEntity*)PDefender)->m_Family == 142 || ((CMobEntity*)PDefender)->m_Family == 143) + { + effect = 35; + } + break; + // Additional Effect: Ice Damage (5% chance guestimate) + case 17548: // Aquilo's Staff + case 16702: // Cougar Baghnakhs + case 16784: // Frostreaper + case 16937: // Ice Brand + case 16861: // Ice Lance + case 16895: // Ice Lance +1 + case 17547: // Ice Staff + case 18503: // Mammut + case 17711: // Shiva's Shotel + case 17135: // Walrus Staff + { + effect = 35; + } + break; + + // Additional Effect: Lightning Damage with Battery + case 17986: // Spark Baselard + case 17987: // Spark Baselard +1 + case 17686: // Spark Bilbo + case 17687: // Spark Bilbo +1 + case 17984: // Spark Dagger + case 17985: // Spark Dagger +1 + case 17688: // Spark Degen + case 17689: // Spark Degen +1 + case 18080: // Spark Fork + case 18081: // Spark Fork +1 + case 17988: // Spark Kris + case 17989: // Spark Kris +1 + case 18078: // Spark Lance + case 18079: // Spark Lance +1 + case 17690: // Spark Rapier + case 17691: // Spark Rapier +1 + case 18076: // Spark Spear + case 18077: // Spark Spear +1 + if (PAmmo->getID() == 18228 || PAmmo->getID() == 18229 || PAmmo->getID() == 18230) + { + chance = 10; + chance += rand()%6; + ammoUse = 1; + effect = 36; + } + break; + + // Additional Effect vs. Quadav: Lightning Damage + case 17415: // Shellbuster + if((((CMobEntity*)PDefender)->m_Family == 200) || ((CMobEntity*)PDefender)->m_Family == 201 + || ((CMobEntity*)PDefender)->m_Family == 202 || ((CMobEntity*)PDefender)->m_Family == 249 + || ((CMobEntity*)PDefender)->m_Family == 337) + { + chance = 10; + effect = 36; + } + break; + // Additional Effect: Lightning Damage (5% chance guestimate) + case 16888: // Battle Fork + case 16889: // Battle Fork +1 + case 18129: // Dabo + case 18130: // Dabo +1 + case 18104: // Fuscina + case 17071: // Heat Rod + case 17511: // Indra Katars + case 17554: // Jupiter's Staff + case 18210: // Raifu + case 18404: // Ramuh's Mace + case 17531: // Ramuh's Staff + case 17553: // Thunder Staff + case 16869: // Thundercloud + case 16837: // Trident + { + chance = 5; + effect = 36; + } + break; + + // Additional Effect: Wind Damage with Fan + case 18366: // Gust Claymore + case 18367: // Gust Claymore +1 + case 18368: // Gust Sword + case 18369: // Gust Sword +1 + case 18370: // Gust Tongue + case 18371: // Gust Tongue +1 + case 17784: // Keppu + case 17785: // Keppu +1 + case 17780: // Kyofu + case 17781: // Kyofu +1 + case 17782: // Reppu + case 17783: // Reppu +1 + if (PAmmo->getID() == 18236 || PAmmo->getID() == 18238 || PAmmo->getID() == 18237) + { + chance = 10; + chance += rand()%6; + ammoUse = 1; + effect = 37; + } + break; + // Additional Effect: Wind Damage (5% chance guestimate) + case 17550: // Auster's Staff + case 18198: // Byakko's Axe + case 16726: // Forseti's Axe + case 18451: // Mokusa + case 18027: // Palladium Dagger + case 18598: // Prester + case 17965: // Sirocco Axe + case 16434: // Sonic Knuckles + case 16675: // Storm Axe + case 16857: // Wind Spear + case 17549: // Wind Staff + case 16542: // Wing Sword + case 17637: // Wing Sword +1 + { + chance = 5; + effect = 37; + } + break; + case 18359: // Boreas Cesti + case 18018: // Sirocco Kukri + { + chance = 100; + effect = 37; + } + break; + + // Additional Effect: Flee (0-75% chance guestimate) + case 17615: // Chicken Knife + { + effect = 38; + } + break; + + //Additional Effect: Dispel Weapons (10% chance needs verifying) + case 16942: // Balmung + case 16944: // Lockheart + case 16950: // Mithril Heart + case 16951: // Mithril Heart +1 + case 18330: // Claustrum - 75 + case 18331: // Claustrum - 80 + case 18648: // Claustrum - 85 + case 18662: // Claustrum - 90 + case 18676: // Claustrum - 95 + case 19757: // Claustrum - 99 + case 19850: // Claustrum - 99 - 2 + { + effect = 39; + } + break; + + // Additional Effect Regen (7% Guestimate) + case 18887: // Dukkha + case 18525: // Himthige + { + effect = 40; + } + break; + + // Additional Effect: Ice Spikes (7% chance guestimate) + case 17564: // Cocytus Pole + { + effect = 41; + } + break; + // Additional Effect: Convert Damage to MP - Tizona + case 19006: // Tizona 75 + { + tizonaChance = rand()%2 + 10; + tizonaPercent = rand()%25 + 10; + effect = 42; + } + break; + case 19075: // Tizona 80 + { + tizonaChance = 15; + tizonaPercent = rand()%10 + 10; + effect = 42; + } + break; + case 19095: // Tizona 85 + { + tizonaChance = 20; + tizonaPercent = rand()%10 + 10; + effect = 42; + } + break; + case 19627: // Tizona 90 + case 19725: // Tizona 95 + { + tizonaChance = 25; + tizonaPercent = rand()%10 + 10; + effect = 42; + } + break; + case 19834: // Tizona 99 + case 19963: // Tizona 99-2 + { + tizonaChance = 30; + tizonaPercent = rand()%10 + 10; + effect = 42; + } + break; + // Additional Effect: Slashing Dmg based on HP Excaliburs + case 18276: // Excalibur 75 + case 18277: // Excalibur 80 + case 18639: // Excalibur 85 + case 18653: // Excalibur 90 + case 18667: // Excalibur 95 + case 19748: // Excalibur 99 + case 19841: // Excalibur 99-2 + { + effect = 43; + } + break; + // Additional Effect: Damage varies with MP + case 16540: // Tyrfing + { + effect = 44; + } + break; + // Additional Effect: Damage varies with TP + case 19315: // Erebus's Lance + if(PDefender->m_EcoSystem == SYSTEM_EMPTY) + { + effect = 45; + } + return; + + // Additional Effect: HP Recover + case 17429: // Dominion Mace + { + effect = 46; + } + return; + + default: + break; + } + switch(effect) + { + case 1: // HP Drain //30 % chance to drain, will heal 30% of damage done if (rand()%100 >= 30 || PWeapon==NULL) return; @@ -1180,18 +2157,762 @@ Action->subparam = (float)(Action->param * 0.3f); PAttacker->addHP(Action->subparam); + if(PAttacker->objtype == TYPE_PC) + { + charutils::UpdateHealth(PAttacker); + } + return; + case 2: // MP Recover + //30 % chance to Recover MP, 4-16 MP + if (rand()%100 <= 30) + { + Action->submessageID = 152; + Action->flag = 3; + int mpRecover = 4; + mpRecover = dsp_cap(mpRecover,4,16); + mpRecover += rand()%13; //4~16 randomised + Action->subparam = mpRecover; + PAttacker->addMP(Action->subparam); + + if(PAttacker->objtype == TYPE_PC){ + charutils::UpdateHealth(PAttacker); + } + } + return; + case 3: // TP Drain + //10 % chance to drain, will restore TP 10% of damage done + if (rand()%100 <= 10 || PWeapon==NULL) return; + + Action->subeffect = SUBEFFECT_TP_DRAIN; + Action->submessageID = 165; + Action->flag = 3; + Action->subparam = (float)(Action->param * 0.1f); + PAttacker->addTP(Action->subparam); + if(PAttacker->objtype == TYPE_PC){ charutils::UpdateHealth(PAttacker); } return; + case 4: // MP Drain + //10 % chance to drain, will restore MP 10% of damage done + if (rand()%100 <= chance || PWeapon==NULL) return; + Action->subeffect = SUBEFFECT_MP_DRAIN; + Action->submessageID = 162; + Action->flag = 3; + Action->subparam = (float)(Action->param * 0.1f); + PAttacker->addMP(Action->subparam); - //Additional Effect: Dispel Weapons (10% chance needs verifying) - case 16942: - case 16944: - case 16950: - case 16951: - case 18330: + if(PAttacker->objtype == TYPE_PC){ + charutils::UpdateHealth(PAttacker); + } + return; + case 5: // HP or MP Drain + //15 % chance to drain, will heal 7.5% of dmg done or restore mp 7.5% of dmg done + if (rand()%100 <= 15 || PWeapon==NULL) return; + if (rand()%2 == 1) + Action->subeffect = SUBEFFECT_HP_DRAIN; + Action->submessageID = 161; + Action->flag = 3; + Action->subparam = (float)(Action->param * 0.075f); + PAttacker->addHP(Action->subparam); + + + if(PAttacker->objtype == TYPE_PC){ + charutils::UpdateHealth(PAttacker); + } + else + Action->subeffect = SUBEFFECT_MP_DRAIN; + Action->submessageID = 162; + Action->flag = 3; + Action->subparam = (float)(Action->param * 0.075f); + PAttacker->addMP(Action->subparam); + + if(PAttacker->objtype == TYPE_PC){ + charutils::UpdateHealth(PAttacker); + } + return; + case 6: // Stun + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_STUNRES)) + { + if(PDefender->hasImmunity(8) == false) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_STUN,EFFECT_STUN,1,0,4))) + { + Action->subeffect = SUBEFFECT_STUN; + Action->subparam = EFFECT_STUN; + Action->submessageID = 160; + Action->flag = 3; + } + } + } + } + return; + case 7: // Paralyze + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_PARALYZERES)) + { + if(PDefender->hasImmunity(32) == false) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_PARALYSIS,EFFECT_PARALYSIS,20,0,10))) + { + Action->subeffect = SUBEFFECT_PARALYSIS; + Action->subparam = EFFECT_PARALYSIS; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + } + return; + case 8: // Petrify + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_PETRIFYRES)) + { + // if(PDefender->hasImmunity(?) == false) // Petrify immunity unknown + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_PETRIFICATION,EFFECT_PETRIFICATION,1,0,30))) + { + Action->subeffect = SUBEFFECT_PETRIFY; + Action->subparam = EFFECT_PETRIFICATION; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + return; + case 9: // Terror + if (rand()%100 <= 5) + { + // if(PDefender->hasImmunity(?) == false) // Terror immunity unknown + if(rand()%100 >= PDefender->getMod(MOD_TERRORRES)) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_TERROR,EFFECT_TERROR,1,0,10))) + { + Action->subparam = EFFECT_TERROR; + Action->submessageID = 160; + Action->flag = 3; + } + } + + } + return; + case 10: // Addle + if (rand()%100 <= 5) + { + // if(PDefender->hasImmunity(?) == false) // Addle immunity unknown + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_ADDLE,EFFECT_ADDLE,1,0,10))) + { + Action->subparam = EFFECT_ADDLE; + Action->submessageID = 160; + Action->flag = 1; + } + } + return; + case 11: // Choke + if (rand()%100 <= 5) + { + // if(PDefender->hasImmunity(?) == false) // Choke immunity unknown + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_CHOKE,EFFECT_CHOKE,5,3,10))) + { + Action->subparam = EFFECT_ADDLE; + Action->submessageID = 160; + Action->flag = 1; + } + } + return; + case 12: // Weight + if (rand()%100 <= 5) + { + if(PDefender->hasImmunity(2) == false) + { + if(rand()%100 >= PDefender->getMod(MOD_GRAVITYRES)) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_WEIGHT,EFFECT_WEIGHT,50,0,30))) + { + Action->subeffect = SUBEFFECT_WEIGHT; + Action->subparam = EFFECT_WEIGHT; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + } + return; + case 13: // Amnesia + if (rand()%100 <= 5) + { + // if(PDefender->hasImmunity(?) == false) // Amnesia immunity unknown + if(rand()%100 >= PDefender->getMod(MOD_AMNESIARES)) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_AMNESIA,EFFECT_AMNESIA,1,0,10))) + { + Action->subparam = EFFECT_AMNESIA; + Action->submessageID = 160; + Action->flag = 1; + } + } + + } + return; + case 14: // Bind + if (rand()%100 <= 5) + { + if(PDefender->hasImmunity(4) == false) + { + if(rand()%100 >= PDefender->getMod(MOD_BINDRES)) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_BIND,EFFECT_BIND,1,0,10))) + { + Action->subeffect = SUBEFFECT_BIND; + Action->subparam = EFFECT_BIND; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + } + return; + case 15: // Slow + if (rand()%100 <= 5) + { + if(PDefender->hasImmunity(128) == false) + { + if(rand()%100 >= PDefender->getMod(MOD_SLOWRES)) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_HASTE,EFFECT_HASTE,-51,0,30))) + { + Action->subparam = EFFECT_HASTE; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + } + return; + case 16: // Flash + if (rand()%100 <= 5) + { + if(PDefender->hasImmunity(64) == false) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_FLASH,EFFECT_FLASH,100,0,30))) + { + Action->subeffect = SUBEFFECT_BLIND; + Action->subparam = EFFECT_FLASH; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + return; + case 17: // TP Removal + if (rand()%100 <= 2) + { + Action->submessageID = 363; + Action->flag = 3; + int tpRemove = 5; + tpRemove = dsp_cap(tpRemove,5,50); + tpRemove += rand()%46; //Random 5-50 + PDefender->addTP(-tpRemove); + + } + return; + case 18: // STR Boost + if (rand()%100 <= 10) + { + int strBoost = 5; + strBoost = dsp_cap(strBoost,5,7); + strBoost += rand()%3; //5~7 randomised + if(PAttacker->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_STR_BOOST,EFFECT_STR_BOOST,strBoost,0,30))) + { + Action->subparam = EFFECT_STR_BOOST; + Action->submessageID = 166; + Action->flag = 1; + } + } + return; + case 19: // Haste + if (rand()%100 <= 7) + { + if(PAttacker->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_HASTE,EFFECT_HASTE,307,0,30))) + { + Action->subparam = EFFECT_HASTE; + Action->submessageID = 166; + Action->flag = 1; + } + } + return; + case 20: // Blink + if (rand()%100 <= 15) + { + if(PAttacker->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_BLINK,EFFECT_BLINK,1,0,5))) + { + Action->subparam = EFFECT_BLINK; + Action->submessageID = 166; + Action->flag = 1; + } + } + return; + case 21: // Poison + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_POISONRES)) + { + if(PDefender->hasImmunity(256) == false) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_POISON,EFFECT_POISON,1,3,30))) + { + Action->subeffect = SUBEFFECT_POISON; + Action->subparam = EFFECT_POISON; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + } + return; + case 22: // Blind + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_BLINDRES)) + { + if(PDefender->hasImmunity(64) == false) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_BLINDNESS,EFFECT_BLINDNESS,10,0,10))) + { + Action->subeffect = SUBEFFECT_BLIND; + Action->subparam = EFFECT_BLINDNESS; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + } + return; + case 23: // Silence + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_SILENCERES)) + { + if(PDefender->hasImmunity(16) == false) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_SILENCE,EFFECT_SILENCE,1,0,10))) + { + Action->subeffect = SUBEFFECT_SILENCE; + Action->subparam = EFFECT_SILENCE; + Action->submessageID = 160; + Action->flag = 1; + } + } + } + } + return; + case 24: // Curse + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_CURSERES)) + { + // if(PDefender->hasImmunity(?) == false) // Curse immunity unknown + + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_CURSE,EFFECT_CURSE,1,0,10))) + { + Action->subeffect = SUBEFFECT_CURSE; + Action->subparam = EFFECT_CURSE; + Action->submessageID = 160; + Action->flag = 3; + } + + } + } + return; + case 25: // Death + if (rand()%100 <= 2) + { + if(rand()%100 >= PDefender->getMod(MOD_DEATHRES)) + { + // if(PDefender->hasImmunity(?) == false) // Death immunity unknown + + Action->subparam = SUBEFFECT_NONE; + Action->submessageID = 160; + Action->flag = 3; + PDefender->addHP(-999999); + } + } + return; + case 26: // Sleep + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_SLEEPRES)) + { + if(!PDefender->isDead() && PDefender->hasImmunity(1) == false) + { + int duration = 25 - (PDefender->GetMLevel() - PAttacker->GetMLevel())*5 - ((float)PDefender->getMod(MOD_SLEEPRES)/5); + + if(duration <= 1) + { + duration = 1; + } + else + { + //randomize sleep duration + duration -= rand()%(duration/2); + } + + duration = dsp_cap(duration,1,25); + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_SLEEP,EFFECT_SLEEP,1,0,duration))) + { + Action->subeffect = SUBEFFECT_SLEEP; + Action->subparam = EFFECT_SLEEP; + Action->submessageID = 160; + Action->flag = 3; + } + } + } + } + return; + case 27: // Evasion Down + if (rand()%100 <= 5) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_EVASION_DOWN,EFFECT_EVASION_DOWN,10,0,10))) + { + Action->subeffect = SUBEFFECT_IMPAIRS_EVASION; + Action->subparam = EFFECT_EVASION_DOWN; + Action->submessageID = 160; + Action->flag = 3; + } + } + return; + case 28: // Defense Down + if (rand()%100 <= 5) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_DEFENSE_DOWN,EFFECT_DEFENSE_DOWN,50,0,10))) + { + Action->subeffect = SUBEFFECT_DEFENSE_DOWN; + Action->subparam = EFFECT_DEFENSE_DOWN; + Action->submessageID = 160; + Action->flag = 1; + } + } + return; + case 29: // Weaken Attack + if (rand()%100 <= 5) + { + if(PDefender->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_ATTACK_DOWN,EFFECT_ATTACK_DOWN,50,0,10))) + { + Action->subeffect = SUBEFFECT_WEAKENS_ATTACKS; + Action->subparam = EFFECT_ATTACK_DOWN; + Action->submessageID = 160; + Action->flag = 1; + } + } + return; + case 30: // Darkness Dmg + if(rand()%100 <= chance) + { + if(rand()%100 >= PDefender->getMod(MOD_DARKRES)) + { + Action->subeffect = SUBEFFECT_DARKNESS_DAMAGE; + Action->submessageID = 163; + Action->flag = 3; + int damage = (PAttacker->INT() - PDefender->INT())/2; + damage += (PAttacker->GetMLevel() - PDefender->GetMLevel()); + damage = dsp_cap(damage,0,50); + damage += PAttacker->GetMLevel()/2; + damage += rand()%20; //At 75 -> 37~56 low or 87~106 high + + damage += (float)damage * ((float)PDefender->getMod(MOD_DARKRES)/-100); + + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 31: // Earth Dmg + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_EARTHRES)) + { + Action->subeffect = SUBEFFECT_EARTH_DAMAGE; + Action->submessageID = 163; + Action->flag = 1; + //calculate damage + uint8 damage = (PAttacker->VIT() - PDefender->VIT())/2; + damage = dsp_cap(damage,0,50); + damage += 10; //10~60 + damage += rand()%8; //10~67 randomised + //set damage TODO: handle resist/staff/day + + damage += (float)damage * ((float)PDefender->getMod(MOD_EARTHRES)/-100); + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 32: // Fire Dmg + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_FIRERES)) + { + Action->subeffect = SUBEFFECT_FIRE_DAMAGE; + Action->submessageID = 163; + Action->flag = 3; + //calculate damage + uint8 damage = (PAttacker->INT() - PDefender->INT())/2; + damage = dsp_cap(damage,0,50); + + damage += 10; //10~60 + damage += rand()%8; //10~67 randomised + //set damage TODO: handle resist/staff/day + damage += (float)damage * ((float)PDefender->getMod(MOD_FIRERES)/-100); + + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 33: // Light Dmg + if (rand()%100 <= chance) + { + if(rand()%100 >= PDefender->getMod(MOD_LIGHTRES)) + { + Action->subeffect = SUBEFFECT_LIGHT_DAMAGE; + Action->submessageID = 163; + Action->flag = 3; + //calculate damage + uint8 damage = (PAttacker->MND() - PDefender->MND())/2; + damage = dsp_cap(damage,0,50); + damage += 10; //10~60 + damage += rand()%8; //10~67 randomised + //set damage TODO: handle resist/staff/day + damage += (float)damage * ((float)PDefender->getMod(MOD_LIGHTRES)/-100); + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 34: // Water Dmg + if (rand()%100 <= chance) + { + if(rand()%100 >= PDefender->getMod(MOD_WATERRES)) + { + Action->subeffect = SUBEFFECT_WATER_DAMAGE; + Action->submessageID = 163; + Action->flag = 1; + //calculate damage + uint8 damage = (PAttacker->MND() - PDefender->MND())/2; + damage = dsp_cap(damage,0,50); + if(ammoUse == 1) + { + if (PAmmo->getID() == 18232) // Hydro Pump + { + damage += 10; //10~60 + damage += rand()%6; //10~65 randomised + } + else if (PAmmo->getID() == 18233) // Kilo Pump + { + damage += 20; //20~70 + damage += rand()%6; //20~75 randomised + } + else if (PAmmo->getID() == 18234) // Mega Pump + { + damage += 30; //30~80 + damage += rand()%6; //30~85 randomised + } + // ShowDebug(CL_CYAN"Water Pump Removal \n"); + if ( (PAmmo->getQuantity()-1) < 1) // ammo will run out after this attack, make sure we remove it from equip + { + uint8 slot = PAttacker->equip[SLOT_AMMO]; + charutils::UnequipItem(PAttacker,SLOT_AMMO); + charutils::UpdateItem(PAttacker, LOC_INVENTORY, slot, -1); + } + else + { + charutils::UpdateItem(PAttacker, LOC_INVENTORY, PAttacker->equip[SLOT_AMMO], -1); + } + PAttacker->pushPacket(new CInventoryFinishPacket()); + } + else + { + damage += 10; //10~60 + damage += rand()%8; //10~67 randomised + } + //set damage TODO: handle resist/staff/day + damage += (float)damage * ((float)PDefender->getMod(MOD_WATERRES)/-100); + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 35: // Ice Dmg + if (rand()%100 <= 5) + { + if(rand()%100 >= PDefender->getMod(MOD_ICERES)) + { + Action->subeffect = SUBEFFECT_ICE_DAMAGE; + Action->submessageID = 163; + Action->flag = 1; + //calculate damage + uint8 damage = (PAttacker->INT() - PDefender->INT())/2; + damage = dsp_cap(damage,0,50); + damage += 10; //10~60 + damage += rand()%8; //10~67 randomised + //set damage TODO: handle resist/staff/day + damage += (float)damage * ((float)PDefender->getMod(MOD_ICERES)/-100); + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 36: // Lightning Dmg + if (rand()%100 <= chance) + { + if(rand()%100 >= PDefender->getMod(MOD_THUNDERRES)) + { + Action->subeffect = SUBEFFECT_LIGHTNING_DAMAGE; + Action->submessageID = 163; + Action->flag = 3; + //calculate damage + uint8 damage = (PAttacker->DEX() - PDefender->DEX())/2; + damage = dsp_cap(damage,0,50); + if(ammoUse == 1) + { + if (PAmmo->getID() == 18228) // Battery + { + damage += 10; //10~60 + damage += rand()%6; //10~65 randomised + } + else if (PAmmo->getID() == 18229) // Kilo Battery + { + damage += 20; //20~70 + damage += rand()%6; //20~75 randomised + } + else if (PAmmo->getID() == 18230) // Mega Battery + { + damage += 30; //30~80 + damage += rand()%6; //30~85 randomised + } + // ShowDebug(CL_CYAN"Battery Removal \n"); + if ( (PAmmo->getQuantity()-1) < 1) // ammo will run out after this attack, make sure we remove it from equip + { + uint8 slot = PAttacker->equip[SLOT_AMMO]; + charutils::UnequipItem(PAttacker,SLOT_AMMO); + charutils::UpdateItem(PAttacker, LOC_INVENTORY, slot, -1); + } + else + { + charutils::UpdateItem(PAttacker, LOC_INVENTORY, PAttacker->equip[SLOT_AMMO], -1); + } + PAttacker->pushPacket(new CInventoryFinishPacket()); + } + else + { + damage += 10; //10~60 + damage += rand()%8; //10~67 randomised + } + //set damage TODO: handle resist/staff/day + damage += (float)damage * ((float)PDefender->getMod(MOD_THUNDERRES)/-100); + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 37: // Wind Dmg + if (rand()%100 <= chance) + { + if(rand()%100 >= PDefender->getMod(MOD_WINDRES)) + { + Action->subeffect = SUBEFFECT_WIND_DAMAGE; + Action->submessageID = 163; + Action->flag = 3; + //calculate damage + uint8 damage = (PAttacker->AGI() - PDefender->AGI())/2; + damage = dsp_cap(damage,0,50); + if(ammoUse == 1) + { + if (PAmmo->getID() == 18236) // Wind Fan + { + damage += 10; //10~60 + damage += rand()%6; //10~65 randomised + } + else if (PAmmo->getID() == 18237) // Kilo Fan + { + damage += 20; //20~70 + damage += rand()%6; //20~75 randomised + } + else if (PAmmo->getID() == 18238) // Mega Fan + { + damage += 30; //30~80 + damage += rand()%6; //30~85 randomised + } + // ShowDebug(CL_CYAN"Wind Fan Removal \n"); + if ( (PAmmo->getQuantity()-1) < 1) // ammo will run out after this attack, make sure we remove it from equip + { + uint8 slot = PAttacker->equip[SLOT_AMMO]; + charutils::UnequipItem(PAttacker,SLOT_AMMO); + charutils::UpdateItem(PAttacker, LOC_INVENTORY, slot, -1); + } + else + { + charutils::UpdateItem(PAttacker, LOC_INVENTORY, PAttacker->equip[SLOT_AMMO], -1); + } + PAttacker->pushPacket(new CInventoryFinishPacket()); + } + else + { + damage += 10; //10~60 + damage += rand()%8; //10~67 randomised + } + damage += (float)damage * ((float)PDefender->getMod(MOD_WINDRES)/-100); + //set damage TODO: handle resi st/staff/day + Action->subparam = damage; + PDefender->addHP(-damage); + } + } + return; + case 38: // Flee + chance = 0; + if(PDefender->GetMLevel() > PAttacker->GetMLevel()) + { + chance += 5*(PDefender->GetMLevel() - PAttacker->GetMLevel()); + chance = dsp_cap(chance,0,75); + } + if(rand()%100 <= chance) + { + if(PAttacker->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_FLEE,EFFECT_FLEE,100,0,30))) + { + Action->subparam = EFFECT_FLEE; + Action->submessageID = 160; + Action->flag = 3; + } + } + return; + case 39: // Dispel if (rand()%100 > 10) return; dispelled = PDefender->StatusEffectContainer->DispelStatusEffect(); // if(dispelled > 0){ @@ -1201,6 +2922,99 @@ // Action->subparam = dispelled; // } return; + case 40: // Regen + if (rand()%100 <= 7) + { + if(PAttacker->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_REGEN,EFFECT_REGEN,30,3,180))) + { + Action->subparam = EFFECT_REGEN; + Action->submessageID = 166; + Action->flag = 1; + } + } + return; + case 41: // Ice Spikes + if (rand()%100 <= 7) + { + if(PAttacker->StatusEffectContainer->AddStatusEffect( + new CStatusEffect(EFFECT_ICE_SPIKES,EFFECT_ICE_SPIKES,20,0,90))) + { + Action->subparam = EFFECT_ICE_SPIKES; + Action->submessageID = 166; + Action->flag = 1; + } + } + return; + case 42: // Damage to MP - Tizona + //12-20 % chance to Recover MP + if (rand()%100 <= tizonaChance) + { + Action->submessageID = 152; + Action->flag = 3; + int mpRecover = ceil((float)(finaldamage * (tizonaPercent / 100.0f))); + // ShowDebug(CL_CYAN"Tizona MP Recovery %d \n", mpRecover); + Action->subparam = mpRecover; + PAttacker->addMP(Action->subparam); + + if(PAttacker->objtype == TYPE_PC){ + charutils::UpdateHealth(PAttacker); + } + } + return; + case 43: // Slashing Dmg -- Excalibur + { + Action->submessageID = 163; + Action->flag = 3; + uint8 damage = ceil((float)PAttacker->health.hp * .25f); + // ShowDebug(CL_CYAN"Excalibur Damage %d \n", damage); + damage += ceil((float)damage * ((float)PDefender->getMod(MOD_SLASHRES)/1000.0f)); + // ShowDebug(CL_CYAN"Excalibur After Resistance Damage %d \n", damage); + Action->subparam = damage; + PDefender->addHP(-damage); + } + return; + case 44: // Dmg varies with MP -- Tyrfing + if (rand()%100 <= 10) + { + Action->submessageID = 163; + Action->flag = 3; + uint8 damage = ceil((float)PAttacker->health.mp / 5.24f); + Action->subparam = damage; + PDefender->addHP(-damage); + } + return; + case 45: // Dmg varies with TP -- Erebus's Lance + if (rand()%100 <= 5) + { + Action->subeffect = SUBEFFECT_LIGHT_DAMAGE; + Action->submessageID = 163; + Action->flag = 3; + uint8 damage = 40; + damage += ceil((float)PAttacker->health.tp / 2.0f); + + Action->subparam = damage; + PDefender->addHP(-damage); + } + return; + case 46: // HP Recover + //15 % chance to Recover HP, 4-16 MP + if (rand()%100 <= 15) + { + Action->submessageID = 167; + Action->flag = 3; + int hpRecover = 4; + hpRecover = dsp_cap(hpRecover,4,16); + hpRecover += rand()%13; //4~16 randomised + Action->subparam = hpRecover; + PAttacker->addHP(Action->subparam); + + if(PAttacker->objtype == TYPE_PC){ + charutils::UpdateHealth(PAttacker); + } + } + return; + default: return; }