diff --git a/config.lua b/config.lua index e354f60..0383f6a 100644 --- a/config.lua +++ b/config.lua @@ -52,7 +52,7 @@ timeBetweenExActions = 1000 -- Map -- NOTE: set mapName WITHOUT .otbm at the end -mapName = "map" +mapName = "mymap" mapAuthor = "CipSoft" -- MySQL diff --git a/data/actions/scripts/misc/fluids.lua b/data/actions/scripts/misc/fluids.lua index 4d8160f..c3ce9d6 100644 --- a/data/actions/scripts/misc/fluids.lua +++ b/data/actions/scripts/misc/fluids.lua @@ -2,12 +2,7 @@ local drunk = Condition(CONDITION_DRUNK) drunk:setParameter(CONDITION_PARAM_TICKS, 60000) local poison = Condition(CONDITION_POISON) -poison:setParameter(CONDITION_PARAM_DELAYED, true) -poison:setParameter(CONDITION_PARAM_MINVALUE, -50) -poison:setParameter(CONDITION_PARAM_MAXVALUE, -120) -poison:setParameter(CONDITION_PARAM_STARTVALUE, -5) -poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 5000) -poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true) +poison:setTiming(100) local messages = { [FLUID_WATER] = "Gulp.", @@ -48,7 +43,7 @@ function onUse(player, item, fromPosition, target, toPosition) if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE or item:getFluidType() == FLUID_RUM then player:addCondition(drunk) elseif self and item:getFluidType() == FLUID_SLIME then - player:addCondition(slime) + player:addCondition(poison) elseif item:getFluidType() == FLUID_MANAFLUID then target:addMana(math.random(50, 100)) target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) diff --git a/data/items/items.srv b/data/items/items.srv index 41bc61b..2aa97e0 100644 --- a/data/items/items.srv +++ b/data/items/items.srv @@ -9303,7 +9303,7 @@ TypeID = 2121 Name = "poison gas" Flags = {CollisionEvent,Unmove,Avoid,MagicField,Expire} Attributes = {AvoidDamageTypes=POISON,Brightness=2,LightColor=104,ExpireTarget=0,TotalExpireTime=250} -MagicField = {Type=POISON,Count=100} +MagicField = {Type=POISON,Count=100,Damage=5} TypeID = 2122 Name = "an energy field" @@ -9338,7 +9338,7 @@ TypeID = 2127 Name = "poison gas" Flags = {CollisionEvent,Unmove,Avoid,MagicField} Attributes = {AvoidDamageTypes=POISON,Brightness=2,LightColor=104} -MagicField = {Type=POISON,Count=100} +MagicField = {Type=POISON,Count=100,Damage=5} TypeID = 2128 Name = "a magic wall" @@ -9376,7 +9376,7 @@ TypeID = 2134 Name = "poison gas" Flags = {CollisionEvent,Unmove,Avoid,MagicField,Expire} Attributes = {AvoidDamageTypes=POISON,Brightness=2,LightColor=214,ExpireTarget=0,TotalExpireTime=8} -MagicField = {Type=POISON,Count=100} +MagicField = {Type=POISON,Count=100,Damage=5} TypeID = 2135 Name = "an energy field" @@ -24442,32 +24442,32 @@ Attributes = {Brightness=7,LightColor=207} TypeID = 5404 Name = "ocean floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5405 Name = "ocean floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5406 Name = "ocean floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5407 Name = "ocean floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5408 Name = "ocean floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5409 Name = "ocean floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5410 @@ -24674,7 +24674,7 @@ TypeID = 5460 Name = "a helmet of the deep" Description = "Enables underwater exploration" Flags = {Take,Armor} -Attributes = {Weight=21000,SlotType=HEAD,ArmorValue=2} # TODO: Drown protection! +Attributes = {Weight=21000,SlotType=HEAD,ArmorValue=2,AbsorbDrown=100} TypeID = 5461 Name = "pirate boots" @@ -25925,12 +25925,12 @@ Name = "" # this is nothing in client TypeID = 5743 Name = "wooden floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5744 Name = "wooden floor" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5745 @@ -26017,7 +26017,7 @@ Attributes = {Waypoints=110} TypeID = 5764 Name = "a ventilation grille" -Flags = {Bank,Unmove} +Flags = {Bank,Unmove,CollisionEvent} Attributes = {Waypoints=500} TypeID = 5765 @@ -26810,7 +26810,7 @@ Flags = {Take} Attributes = {Weight=3200} TypeID = 5929 -Name = "a goldfish bow" +Name = "a goldfish bowl" Flags = {Take} Attributes = {Weight=3200} diff --git a/data/monster/781/acolyte of the cult.xml b/data/monster/781/acolyte of the cult.xml new file mode 100644 index 0000000..f446281 --- /dev/null +++ b/data/monster/781/acolyte of the cult.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/adept of the cult.xml b/data/monster/781/adept of the cult.xml new file mode 100644 index 0000000..4cc880b --- /dev/null +++ b/data/monster/781/adept of the cult.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/azure frog.xml b/data/monster/781/azure frog.xml new file mode 100644 index 0000000..dc482fc --- /dev/null +++ b/data/monster/781/azure frog.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/blood crab.xml b/data/monster/781/blood crab.xml new file mode 100644 index 0000000..87e40e1 --- /dev/null +++ b/data/monster/781/blood crab.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/brutus bloodbeard.xml b/data/monster/781/brutus bloodbeard.xml new file mode 100644 index 0000000..62c3b89 --- /dev/null +++ b/data/monster/781/brutus bloodbeard.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/carrion worm.xml b/data/monster/781/carrion worm.xml new file mode 100644 index 0000000..72b53ad --- /dev/null +++ b/data/monster/781/carrion worm.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/coral frog.xml b/data/monster/781/coral frog.xml new file mode 100644 index 0000000..dbca01d --- /dev/null +++ b/data/monster/781/coral frog.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/crimson frog.xml b/data/monster/781/crimson frog.xml new file mode 100644 index 0000000..6322572 --- /dev/null +++ b/data/monster/781/crimson frog.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/deadeye devious.xml b/data/monster/781/deadeye devious.xml new file mode 100644 index 0000000..ac4df84 --- /dev/null +++ b/data/monster/781/deadeye devious.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/enlightened of the cult.xml b/data/monster/781/enlightened of the cult.xml new file mode 100644 index 0000000..0f5b60e --- /dev/null +++ b/data/monster/781/enlightened of the cult.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/green frog.xml b/data/monster/781/green frog.xml new file mode 100644 index 0000000..1685b29 --- /dev/null +++ b/data/monster/781/green frog.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/island troll.xml b/data/monster/781/island troll.xml new file mode 100644 index 0000000..fc0ca97 --- /dev/null +++ b/data/monster/781/island troll.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/lavahole.xml b/data/monster/781/lavahole.xml new file mode 100644 index 0000000..b806384 --- /dev/null +++ b/data/monster/781/lavahole.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/lethal lissy.xml b/data/monster/781/lethal lissy.xml new file mode 100644 index 0000000..c387f63 --- /dev/null +++ b/data/monster/781/lethal lissy.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/mammoth.xml b/data/monster/781/mammoth.xml new file mode 100644 index 0000000..e2ca883 --- /dev/null +++ b/data/monster/781/mammoth.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/massive water elemental.xml b/data/monster/781/massive water elemental.xml new file mode 100644 index 0000000..9bb6fa8 --- /dev/null +++ b/data/monster/781/massive water elemental.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/morgaroth.xml b/data/monster/781/morgaroth.xml new file mode 100644 index 0000000..17072c3 --- /dev/null +++ b/data/monster/781/morgaroth.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/novice of the cult.xml b/data/monster/781/novice of the cult.xml new file mode 100644 index 0000000..7bdd721 --- /dev/null +++ b/data/monster/781/novice of the cult.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/orchid frog.xml b/data/monster/781/orchid frog.xml new file mode 100644 index 0000000..4f2e9ac --- /dev/null +++ b/data/monster/781/orchid frog.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/pirate buccaneer.xml b/data/monster/781/pirate buccaneer.xml new file mode 100644 index 0000000..d8d4697 --- /dev/null +++ b/data/monster/781/pirate buccaneer.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/pirate corsair.xml b/data/monster/781/pirate corsair.xml new file mode 100644 index 0000000..e2a0e5d --- /dev/null +++ b/data/monster/781/pirate corsair.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/pirate cutthroat.xml b/data/monster/781/pirate cutthroat.xml new file mode 100644 index 0000000..c89a9e6 --- /dev/null +++ b/data/monster/781/pirate cutthroat.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/pirate ghost.xml b/data/monster/781/pirate ghost.xml new file mode 100644 index 0000000..0886ace --- /dev/null +++ b/data/monster/781/pirate ghost.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/pirate marauder.xml b/data/monster/781/pirate marauder.xml new file mode 100644 index 0000000..3051600 --- /dev/null +++ b/data/monster/781/pirate marauder.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/pirate skeleton.xml b/data/monster/781/pirate skeleton.xml new file mode 100644 index 0000000..489b2b2 --- /dev/null +++ b/data/monster/781/pirate skeleton.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara constrictor scout.xml b/data/monster/781/quara constrictor scout.xml new file mode 100644 index 0000000..6fa015c --- /dev/null +++ b/data/monster/781/quara constrictor scout.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara constrictor.xml b/data/monster/781/quara constrictor.xml new file mode 100644 index 0000000..3838bd5 --- /dev/null +++ b/data/monster/781/quara constrictor.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara hydromancer scout.xml b/data/monster/781/quara hydromancer scout.xml new file mode 100644 index 0000000..9fd93ca --- /dev/null +++ b/data/monster/781/quara hydromancer scout.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara hydromancer.xml b/data/monster/781/quara hydromancer.xml new file mode 100644 index 0000000..1200a38 --- /dev/null +++ b/data/monster/781/quara hydromancer.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara mantassin scout.xml b/data/monster/781/quara mantassin scout.xml new file mode 100644 index 0000000..6b8b723 --- /dev/null +++ b/data/monster/781/quara mantassin scout.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara mantassin.xml b/data/monster/781/quara mantassin.xml new file mode 100644 index 0000000..32329ba --- /dev/null +++ b/data/monster/781/quara mantassin.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara pincher scout.xml b/data/monster/781/quara pincher scout.xml new file mode 100644 index 0000000..964beb7 --- /dev/null +++ b/data/monster/781/quara pincher scout.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara pincher.xml b/data/monster/781/quara pincher.xml new file mode 100644 index 0000000..0a93593 --- /dev/null +++ b/data/monster/781/quara pincher.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara predator scout.xml b/data/monster/781/quara predator scout.xml new file mode 100644 index 0000000..e50b854 --- /dev/null +++ b/data/monster/781/quara predator scout.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/quara predator.xml b/data/monster/781/quara predator.xml new file mode 100644 index 0000000..4558283 --- /dev/null +++ b/data/monster/781/quara predator.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/ron the ripper.xml b/data/monster/781/ron the ripper.xml new file mode 100644 index 0000000..2a3cdf2 --- /dev/null +++ b/data/monster/781/ron the ripper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/seagull.xml b/data/monster/781/seagull.xml new file mode 100644 index 0000000..a64e4a6 --- /dev/null +++ b/data/monster/781/seagull.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/thornback tortoise.xml b/data/monster/781/thornback tortoise.xml new file mode 100644 index 0000000..51d578e --- /dev/null +++ b/data/monster/781/thornback tortoise.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/thul.xml b/data/monster/781/thul.xml new file mode 100644 index 0000000..889e519 --- /dev/null +++ b/data/monster/781/thul.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/tiquandas revenge.xml b/data/monster/781/tiquandas revenge.xml new file mode 100644 index 0000000..c257d46 --- /dev/null +++ b/data/monster/781/tiquandas revenge.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/toad.xml b/data/monster/781/toad.xml new file mode 100644 index 0000000..9b4f224 --- /dev/null +++ b/data/monster/781/toad.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/781/tortoise.xml b/data/monster/781/tortoise.xml new file mode 100644 index 0000000..876b0aa --- /dev/null +++ b/data/monster/781/tortoise.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/monster/ferumbras.xml b/data/monster/ferumbras.xml index 22a64cd..cc11d19 100644 --- a/data/monster/ferumbras.xml +++ b/data/monster/ferumbras.xml @@ -1,7 +1,7 @@ - + - + diff --git a/data/monster/monsters.xml b/data/monster/monsters.xml index d844a6e..cb9aa3f 100644 --- a/data/monster/monsters.xml +++ b/data/monster/monsters.xml @@ -163,4 +163,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/movements/movements.xml b/data/movements/movements.xml index 420dbab..676ad85 100644 --- a/data/movements/movements.xml +++ b/data/movements/movements.xml @@ -388,7 +388,13 @@ - + + + + + + + @@ -664,6 +670,10 @@ + + + + diff --git a/data/movements/scripts/misc/drowning.lua b/data/movements/scripts/misc/drowning.lua new file mode 100644 index 0000000..e346815 --- /dev/null +++ b/data/movements/scripts/misc/drowning.lua @@ -0,0 +1,31 @@ +local condition = Condition(CONDITION_DROWN) +condition:setTiming(5) + + +function onStepIn(creature, item, position, fromPosition) + local player = creature:getPlayer() + if player == nil then + return true + end + + local helmet = player:getSlotItem(CONST_SLOT_HEAD) + if helmet ~= nil and helmet:getId() == 5460 then + return true + end + + if math.random(1, 10) == 1 then + position:sendMagicEffect(CONST_ME_BUBBLES) + end + player:addCondition(condition) + return true +end + +function onStepOut(creature, item, position, fromPosition) + local player = creature:getPlayer() + if player == nil then + return true + end + + player:removeCondition(CONDITION_DROWN) + return true +end diff --git a/src/combat.cpp b/src/combat.cpp index 52bc2da..e63bc0f 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -82,6 +82,9 @@ CombatType_t Combat::ConditionToDamageType(ConditionType_t type) case CONDITION_POISON: return COMBAT_EARTHDAMAGE; + case CONDITION_DROWN: + return COMBAT_DROWNDAMAGE; + default: break; } @@ -101,6 +104,9 @@ ConditionType_t Combat::DamageToConditionType(CombatType_t type) case COMBAT_EARTHDAMAGE: return CONDITION_POISON; + case COMBAT_DROWNDAMAGE: + return CONDITION_DROWN; + default: return CONDITION_NONE; } diff --git a/src/condition.cpp b/src/condition.cpp index 13b02cd..4d923d2 100644 --- a/src/condition.cpp +++ b/src/condition.cpp @@ -131,6 +131,7 @@ Condition* Condition::createCondition(ConditionId_t id, ConditionType_t type, in case CONDITION_POISON: case CONDITION_FIRE: case CONDITION_ENERGY: + case CONDITION_DROWN: return new ConditionDamage(id, type, subId); case CONDITION_HASTE: @@ -915,6 +916,28 @@ bool ConditionDamage::executeCondition(Creature* creature, int32_t) } else { return false; } + } else if (conditionType == CONDITION_DROWN) { + if (isFirstCycle && count - max_count == -2) { + doDamage(creature, -20); + isFirstCycle = false; + count = max_count; + return true; + } + + const int32_t r_cycle = cycle; + if (r_cycle) { + if (count <= 0) { + count = max_count; + cycle = r_cycle + 2 * (r_cycle <= 0) - 1; + doDamage(creature, -20); + } + else { + --count; + } + } + else { + return false; + } } return true; @@ -994,6 +1017,10 @@ uint32_t ConditionDamage::getIcons() const icons |= ICON_POISON; break; + case CONDITION_DROWN: + icons |= ICON_DROWNING; + break; + default: break; } diff --git a/src/condition.h b/src/condition.h index 2535aa0..ed33877 100644 --- a/src/condition.h +++ b/src/condition.h @@ -255,6 +255,8 @@ class ConditionDamage final : public Condition count = max_count = 8; } else if (type == CONDITION_ENERGY) { count = max_count = 10; + } else if (type == CONDITION_DROWN) { + count = max_count = 3; } } @@ -281,7 +283,7 @@ class ConditionDamage final : public Condition int32_t max_count = 0; int32_t factor_percent = -1; int32_t hit_damage = 0; - + bool isFirstCycle = true; uint32_t owner = 0; bool doDamage(Creature* creature, int32_t healthChange); diff --git a/src/const.h b/src/const.h index fd9107c..c4dffb2 100644 --- a/src/const.h +++ b/src/const.h @@ -171,7 +171,8 @@ enum Icons_t { ICON_MANASHIELD = 1 << 4, ICON_PARALYZE = 1 << 5, ICON_HASTE = 1 << 6, - ICON_SWORDS = 1 << 7 + ICON_SWORDS = 1 << 7, + ICON_DROWNING = 1 << 8, }; enum WeaponType_t : uint8_t { diff --git a/src/creature.cpp b/src/creature.cpp index 8bd0318..da8bf6d 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -1026,6 +1026,9 @@ void Creature::onTickCondition(ConditionType_t type, bool& bRemove) case CONDITION_POISON: bRemove = (field->getCombatType() != COMBAT_EARTHDAMAGE); break; + case CONDITION_DROWN: + bRemove = (field->getCombatType() != COMBAT_DROWNDAMAGE); + break; default: break; } diff --git a/src/enums.h b/src/enums.h index a403145..d6bf53a 100644 --- a/src/enums.h +++ b/src/enums.h @@ -102,8 +102,9 @@ enum CombatType_t : uint16_t { COMBAT_LIFEDRAIN = 1 << 5, COMBAT_MANADRAIN = 1 << 6, COMBAT_HEALING = 1 << 7, + COMBAT_DROWNDAMAGE = 1 << 8, - COMBAT_COUNT = 9 + COMBAT_COUNT = 10 }; enum CombatParam_t { @@ -249,6 +250,7 @@ enum ConditionType_t { CONDITION_EXHAUST = 1 << 17, CONDITION_PACIFIED = 1 << 18, CONDITION_AGGRESSIVE = 1 << 19, + CONDITION_DROWN = 1 << 20, }; enum ConditionId_t : int8_t { diff --git a/src/game.cpp b/src/game.cpp index 2291a02..0a487a2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3391,6 +3391,12 @@ void Game::combatGetTypeInfo(CombatType_t combatType, Creature* target, TextColo effect = CONST_ME_MAGIC_RED; break; } + + case COMBAT_DROWNDAMAGE: { + color = TEXTCOLOR_LIGHTBLUE; + effect = CONST_ME_LOSEENERGY; + break; + } default: { color = TEXTCOLOR_NONE; effect = CONST_ME_NONE; diff --git a/src/items.cpp b/src/items.cpp index 767ada3..8259ff0 100644 --- a/src/items.cpp +++ b/src/items.cpp @@ -402,6 +402,8 @@ bool Items::loadItems() items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_FIREDAMAGE)] += script.readNumber(); } else if (identifier == "absorbpoison") { items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_EARTHDAMAGE)] += script.readNumber(); + } else if (identifier == "absorbdrown") { + items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_DROWNDAMAGE)] += script.readNumber(); } else if (identifier == "absorblifedrain") { items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_LIFEDRAIN)] += script.readNumber(); } else if (identifier == "absorbmanadrain") { @@ -515,7 +517,6 @@ bool Items::loadItems() items[id].conditionDamage.reset(conditionDamage); } else if (identifier == "poison") { conditionDamage = new ConditionDamage(CONDITIONID_COMBAT, CONDITION_POISON); - conditionDamage->setParam(CONDITION_PARAM_DELAYED, true); combatType = COMBAT_EARTHDAMAGE; items[id].combatType = combatType; items[id].conditionDamage.reset(conditionDamage); diff --git a/src/luascript.cpp b/src/luascript.cpp index 4338a6b..93466f1 100644 --- a/src/luascript.cpp +++ b/src/luascript.cpp @@ -1069,6 +1069,7 @@ void LuaScriptInterface::registerFunctions() registerEnum(COMBAT_ENERGYDAMAGE) registerEnum(COMBAT_EARTHDAMAGE) registerEnum(COMBAT_FIREDAMAGE) + registerEnum(COMBAT_DROWNDAMAGE) registerEnum(COMBAT_UNDEFINEDDAMAGE) registerEnum(COMBAT_LIFEDRAIN) registerEnum(COMBAT_MANADRAIN) @@ -1091,6 +1092,7 @@ void LuaScriptInterface::registerFunctions() registerEnum(CONDITION_POISON) registerEnum(CONDITION_FIRE) registerEnum(CONDITION_ENERGY) + registerEnum(CONDITION_DROWN) registerEnum(CONDITION_HASTE) registerEnum(CONDITION_PARALYZE) registerEnum(CONDITION_OUTFIT) @@ -1152,6 +1154,7 @@ void LuaScriptInterface::registerFunctions() registerEnum(CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT) registerEnum(CONDITION_PARAM_STAT_MAGICPOINTSPERCENT) registerEnum(CONDITION_PARAM_PERIODICDAMAGE) + registerEnum(CONDITION_PARAM_HIT_DAMAGE) registerEnum(CONDITION_PARAM_SKILL_MELEEPERCENT) registerEnum(CONDITION_PARAM_SKILL_FISTPERCENT) registerEnum(CONDITION_PARAM_SKILL_CLUBPERCENT) diff --git a/src/monster.cpp b/src/monster.cpp index 9c65630..60fd7d1 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -876,7 +876,7 @@ void Monster::doAttacking(uint32_t) for (spellBlock_t& spellBlock : mType->info.attackSpells) { if (spellBlock.range != 0 && std::max(Position::getDistanceX(myPos, targetPos), Position::getDistanceY(myPos, targetPos)) <= spellBlock.range) { - if (normal_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || normal_random(1, 3) == 1)) { + if (uniform_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || uniform_random(1, 3) == 1)) { updateLookDirection(); minCombatValue = spellBlock.minCombatValue; @@ -977,7 +977,7 @@ void Monster::onThinkTarget(uint32_t interval) void Monster::onThinkDefense(uint32_t) { for (const spellBlock_t& spellBlock : mType->info.defenseSpells) { - if (normal_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || normal_random(1, 3) == 1)) { + if (uniform_random(0, spellBlock.chance) == 0 && (master || health > mType->info.runAwayHealth || uniform_random(1, 3) == 1)) { minCombatValue = spellBlock.minCombatValue; maxCombatValue = spellBlock.maxCombatValue; spellBlock.spell->castSpell(this, this); diff --git a/src/monsters.cpp b/src/monsters.cpp index 9b5c467..e5101d5 100644 --- a/src/monsters.cpp +++ b/src/monsters.cpp @@ -392,6 +392,8 @@ bool Monsters::deserializeSpell(const pugi::xml_node& node, spellBlock_t& sb, co combat->setParam(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE); } else if (tmpName == "energy") { combat->setParam(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE); + } else if (tmpName == "drown") { + combat->setParam(COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE); } else if (tmpName == "lifedrain") { combat->setParam(COMBAT_PARAM_TYPE, COMBAT_LIFEDRAIN); } else if (tmpName == "manadrain") { @@ -480,7 +482,7 @@ bool Monsters::deserializeSpell(const pugi::xml_node& node, spellBlock_t& sb, co } else if (tmpName == "firecondition" || tmpName == "energycondition" || tmpName == "earthcondition" || tmpName == "poisoncondition" || tmpName == "icecondition" || tmpName == "freezecondition" || - tmpName == "physicalcondition") { + tmpName == "physicalcondition" || tmpName == "drowncondition") { ConditionType_t conditionType = CONDITION_NONE; if (tmpName == "firecondition") { @@ -489,6 +491,8 @@ bool Monsters::deserializeSpell(const pugi::xml_node& node, spellBlock_t& sb, co conditionType = CONDITION_POISON; } else if (tmpName == "energycondition") { conditionType = CONDITION_ENERGY; + } else if (tmpName == "drowncondition") { + conditionType = CONDITION_DROWN; } int32_t cycle = 0; @@ -828,6 +832,9 @@ bool Monsters::loadMonster(const std::string& file, const std::string& monsterNa } else if (tmpStrValue == "fire") { mType->info.damageImmunities |= COMBAT_FIREDAMAGE; mType->info.conditionImmunities |= CONDITION_FIRE; + } else if (tmpStrValue == "drown") { + mType->info.damageImmunities |= COMBAT_DROWNDAMAGE; + mType->info.conditionImmunities |= CONDITION_DROWN; } else if (tmpStrValue == "poison" || tmpStrValue == "earth") { mType->info.damageImmunities |= COMBAT_EARTHDAMAGE; @@ -861,6 +868,11 @@ bool Monsters::loadMonster(const std::string& file, const std::string& monsterNa mType->info.damageImmunities |= COMBAT_FIREDAMAGE; mType->info.conditionImmunities |= CONDITION_FIRE; } + } else if ((attr = immunityNode.attribute("drown"))) { + if (attr.as_bool()) { + mType->info.damageImmunities |= COMBAT_DROWNDAMAGE; + mType->info.conditionImmunities |= CONDITION_DROWN; + } } else if ((attr = immunityNode.attribute("poison")) || (attr = immunityNode.attribute("earth"))) { if (attr.as_bool()) { mType->info.damageImmunities |= COMBAT_EARTHDAMAGE; diff --git a/src/movement.cpp b/src/movement.cpp index 184a44a..0dc15bf 100644 --- a/src/movement.cpp +++ b/src/movement.cpp @@ -646,6 +646,10 @@ uint32_t MoveEvent::EquipItem(MoveEvent* moveEvent, Player* player, Item* item, player->sendIcons(); } + if (it.abilities->absorbPercent[combatTypeToIndex(COMBAT_DROWNDAMAGE)] == 100) { + player->removeCondition(CONDITION_DROWN); + } + if (it.abilities->regeneration) { Condition* condition = Condition::createCondition(static_cast(slot), CONDITION_REGENERATION, -1, 0); diff --git a/src/player.cpp b/src/player.cpp index a9f114c..49bb168 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -1164,6 +1164,7 @@ void Player::onThink(uint32_t interval) addMessageBuffer(); } + lastWalkingTime += interval; if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer()) { idleTime += interval; const int32_t kickAfterMinutes = g_config.getNumber(ConfigManager::KICK_AFTER_MINUTES); @@ -2951,6 +2952,10 @@ void Player::onAddCombatCondition(ConditionType_t type) sendTextMessage(MESSAGE_STATUS_DEFAULT, "You are poisoned."); break; + case CONDITION_DROWN: + sendTextMessage(MESSAGE_STATUS_SMALL, "You are drowning."); + break; + case CONDITION_PARALYZE: sendTextMessage(MESSAGE_STATUS_DEFAULT, "You are paralyzed."); break; diff --git a/src/player.h b/src/player.h index 5050903..3f39f9c 100644 --- a/src/player.h +++ b/src/player.h @@ -286,6 +286,19 @@ class Player final : public Creature, public Cylinder void resetIdleTime() { idleTime = 0; + resetLastWalkingTime(); + } + + int32_t getIdleTime() const { + return idleTime; + } + + void resetLastWalkingTime() { + lastWalkingTime = 0; + } + + int32_t getLastWalkingTime() const { + return lastWalkingTime; } bool isInGhostMode() const { @@ -1045,6 +1058,7 @@ class Player final : public Creature, public Cylinder int32_t bloodHitCount = 0; int32_t shieldBlockCount = 0; int32_t idleTime = 0; + int32_t lastWalkingTime = 0; uint16_t staminaMinutes = 3360; uint16_t maxWriteLen = 0; diff --git a/src/spells.cpp b/src/spells.cpp index b08a048..03500da 100644 --- a/src/spells.cpp +++ b/src/spells.cpp @@ -398,6 +398,7 @@ bool Spell::configureSpell(const pugi::xml_node& node) "firecondition", "poisoncondition", "energycondition", + "drowncondition", }; //static size_t size = sizeof(reservedList) / sizeof(const char*); diff --git a/src/tools.cpp b/src/tools.cpp index 84560bc..506f512 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -672,6 +672,7 @@ ShootTypeNames shootTypeNames[] = { CombatTypeNames combatTypeNames[] = { {"physical", COMBAT_PHYSICALDAMAGE}, {"energy", COMBAT_ENERGYDAMAGE}, + {"drown", COMBAT_DROWNDAMAGE}, {"earth", COMBAT_EARTHDAMAGE}, {"poison", COMBAT_EARTHDAMAGE}, {"fire", COMBAT_FIREDAMAGE}, @@ -914,6 +915,8 @@ size_t combatTypeToIndex(CombatType_t combatType) return 6; case COMBAT_HEALING: return 7; + case COMBAT_DROWNDAMAGE: + return 8; default: return 0; }