diff --git a/CMakeLists.txt b/CMakeLists.txt index 65d1daa..3150690 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(cotire) -add_compile_options(-Wall -Werror -pipe -fvisibility=hidden) +add_compile_options(-Wall -pipe -fvisibility=hidden) if (CMAKE_COMPILER_IS_GNUCXX) add_compile_options(-fno-strict-aliasing) diff --git a/data/XML/stages.xml b/data/XML/stages.xml index 6895898..8638335 100644 --- a/data/XML/stages.xml +++ b/data/XML/stages.xml @@ -1,9 +1,11 @@ - - - - - - + + + + + + + + \ No newline at end of file diff --git a/data/spells/scripts/runes/intense healing.lua b/data/spells/scripts/runes/intense healing.lua index 37f4d0a..4d5643d 100644 --- a/data/spells/scripts/runes/intense healing.lua +++ b/data/spells/scripts/runes/intense healing.lua @@ -11,5 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") function onCastSpell(creature, variant) + doRemoveCondition(creature, CONDITION_PARALYZE return combat:execute(creature, variant) end \ No newline at end of file diff --git a/data/spells/scripts/runes/ultimate healing.lua b/data/spells/scripts/runes/ultimate healing.lua index 9274f21..bde8e71 100644 --- a/data/spells/scripts/runes/ultimate healing.lua +++ b/data/spells/scripts/runes/ultimate healing.lua @@ -2,7 +2,7 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) -combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) +-- combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) @@ -12,5 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") function onCastSpell(creature, variant, isHotkey) + doRemoveCondition(creature, CONDITION_PARALYZE) return combat:execute(creature, variant) end \ No newline at end of file diff --git a/data/spells/scripts/spells/heal friend.lua b/data/spells/scripts/spells/heal friend.lua index 37d57f4..1b85471 100644 --- a/data/spells/scripts/spells/heal friend.lua +++ b/data/spells/scripts/spells/heal friend.lua @@ -7,15 +7,10 @@ combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local base = 120 local variation = 40 - - local formula = 3 * maglevel + (2 * level) - - if formula >= 101 then - formula = 100 - end - - local min = (formula * (base - variation)) / 100 - local max = (formula * (base + variation)) / 100 + + local min = math.max((base - variation), ((3 * maglevel + 2 * level) * (base - variation) / 100)) + local max = math.max((base + variation), ((3 * maglevel + 2 * level) * (base + variation) / 100)) + return min, max end diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..49fbf7e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.7' +services: + db: + image: mysql:5.7 + restart: always + environment: + MYSQL_DATABASE: 'nostalrius' + # So you don't have to use root, but you can if you like + MYSQL_USER: 'nostalrius' + # You can use whatever password you like + MYSQL_PASSWORD: '123123' + # Password for root access + MYSQL_ROOT_PASSWORD: '123123' + tty: true + ports: + # : < MySQL Port running inside container> + - '7708:3306' + expose: + # Opens port 3306 on the container + - '3306' + # Where our data will be persisted + volumes: + - my-db:/var/lib/mysql +# Names our volume +volumes: + my-db: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee3ba35..afdd2f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,7 +65,7 @@ set(tfs_SRC ${CMAKE_CURRENT_LIST_DIR}/tools.cpp ${CMAKE_CURRENT_LIST_DIR}/vocation.cpp ${CMAKE_CURRENT_LIST_DIR}/waitlist.cpp - ${CMAKE_CURRENT_LIST_DIR}/weapons.cpp + #${CMAKE_CURRENT_LIST_DIR}/weapons.cpp ${CMAKE_CURRENT_LIST_DIR}/wildcardtree.cpp ) diff --git a/src/combat.cpp b/src/combat.cpp index 2e62e91..42888b0 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -790,7 +790,9 @@ int32_t Combat::computeDamage(Creature* creature, int32_t strength, int32_t vari if (creature) { if (Player* player = creature->getPlayer()) { - int32_t formula = 3 * player->getMagicLevel() + 2 * player->getLevel(); + int32_t formulaMin = 3.5 * player->getMagicLevel() + 2 * player->getLevel(); + int32_t formulaMax = formulaMin * 2; + int32_t formula = rand() % formulaMax; damage = formula * damage / 100; } } @@ -798,6 +800,46 @@ int32_t Combat::computeDamage(Creature* creature, int32_t strength, int32_t vari return damage; } +int32_t Combat::getKnightTotalDamage(int32_t attackSkill, int32_t attackValue, fightMode_t fightMode) +{ + int32_t damage = attackValue; + + switch (fightMode) { + case FIGHTMODE_ATTACK: + damage += 2 * damage / 10; + break; + case FIGHTMODE_DEFENSE: + damage -= 4 * damage / 10; + break; + default: break; + } + + int32_t formula = (5 * (attackSkill * 1.3) + 60) * (damage * 1); + int32_t randresult = rand() % 100 + (attackSkill / 2); + int32_t totalDamage = -(ceil(formula * ((rand() % 100 + randresult) / 2) / 10000.)); + return totalDamage; +} + +int32_t Combat::getPaladinTotalDamage(int32_t attackSkill, int32_t attackValue, fightMode_t fightMode) +{ + int32_t damage = attackValue; + + switch (fightMode) { + case FIGHTMODE_ATTACK: + damage += 2 * damage / 10; + break; + case FIGHTMODE_DEFENSE: + damage -= 4 * damage / 10; + break; + default: break; + } + + int32_t formula = (5 * (attackSkill * 1.3) + 60) * damage; + int32_t randresult = rand() % 100 + (attackSkill / 2.5); + int32_t totalDamage = -(ceil(formula * ((rand() % 100 + randresult) / 2) / 10000.)); + return totalDamage; +} + int32_t Combat::getTotalDamage(int32_t attackSkill, int32_t attackValue, fightMode_t fightMode) { int32_t damage = attackValue; @@ -874,7 +916,14 @@ bool Combat::closeAttack(Creature* attacker, Creature* target, fightMode_t fight CombatDamage combatDamage; combatDamage.type = combatParams.combatType; - int32_t totalDamage = Combat::getTotalDamage(skillValue, attackValue, fightMode); + int32_t totalDamage = 0; + if (Player* player = attacker->getPlayer()) { + totalDamage = Combat::getKnightTotalDamage(skillValue, attackValue, fightMode); + } else { + totalDamage = Combat::getTotalDamage(skillValue, attackValue, fightMode); + } + + combatDamage.value = totalDamage; bool hit = Combat::doCombatHealth(attacker, target, combatDamage, combatParams); @@ -990,7 +1039,15 @@ bool Combat::rangeAttack(Creature* attacker, Creature* target, fightMode_t fight CombatDamage combatDamage; combatDamage.type = combatParams.combatType; - combatDamage.value = Combat::getTotalDamage(skillValue, attackValue, fightMode); + int32_t totalDamage = 0; + if (Player* player = attacker->getPlayer()) { + totalDamage = Combat::getPaladinTotalDamage(skillValue, attackValue, fightMode); + } else { + totalDamage = Combat::getTotalDamage(skillValue, attackValue, fightMode); + } + + + combatDamage.value = totalDamage; if (weapon) { hitChance = 75; // throwables and such @@ -1185,13 +1242,13 @@ void Combat::circleShapeSpell(Creature* attacker, const Position& toPos, int32_t void Combat::getAttackValue(Creature* creature, uint32_t& attackValue, uint32_t& skillValue, uint8_t& skill, bool fist) { skill = SKILL_FIST; - + if (Player* player = creature->getPlayer()) { Item* weapon = player->getWeapon(); if (weapon && !fist) { switch (weapon->getWeaponType()) { case WEAPON_AXE: { - skill = SKILL_AXE; + skill = SKILL_AXE; attackValue = weapon->getAttack(); break; } @@ -1221,8 +1278,24 @@ void Combat::getAttackValue(Creature* creature, uint32_t& attackValue, uint32_t& attackValue = 7; break; } - + skillValue = player->getSkillLevel(skill); + // initialValue = 0; + // if (skillValue >= 100) { + // initialValue = 6; + // } else if (skillValue >= 90) { + // initialValue = 5; + // } else if (skillValue >= 80) { + // initialValue = 4; + // } else if (skillValue >= 70) { + // initialValue = 3; + // } else if (skillValue >= 60) { + // initialValue = 2; + // } else if (skillValue >= 40) { + // initialValue = 1; + // } + // int32_t randPlusAttack = (skillValue / 2) ; + //attackValue = 5 + (attackValue * 0.021) * pow(skillValue, (5/4)); } else { attackValue = 7; skillValue = player->getSkillLevel(skill); diff --git a/src/combat.h b/src/combat.h index bc07037..3a6f965 100644 --- a/src/combat.h +++ b/src/combat.h @@ -283,6 +283,8 @@ class Combat static int32_t computeDamage(Creature* creature, int32_t strength, int32_t variation); static int32_t getTotalDamage(int32_t attackSkill, int32_t attackValue, fightMode_t fightMode); + static int32_t getKnightTotalDamage(int32_t attackSkill, int32_t attackValue, fightMode_t fightMode); + static int32_t getPaladinTotalDamage(int32_t attackSkill, int32_t attackValue, fightMode_t fightMode); static bool attack(Creature* attacker, Creature* target); static bool closeAttack(Creature* attacker, Creature* target, fightMode_t fightMode, bool fist = false); diff --git a/src/tile.cpp b/src/tile.cpp index 14da480..7ba5986 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -725,6 +725,8 @@ void Tile::addThing(int32_t, Thing* thing) } else if (itemType.alwaysOnTop) { if (itemType.isSplash() && items) { //remove old splash if exists + SpectatorVec spectators; + g_game.map.getSpectators(spectators, getPosition(), true, true); for (ItemVector::const_iterator it = items->getBeginTopItem(), end = items->getEndTopItem(); it != end; ++it) { Item* oldSplash = *it; if (!Item::items[oldSplash->getID()].isSplash()) { @@ -735,6 +737,7 @@ void Tile::addThing(int32_t, Thing* thing) oldSplash->setParent(nullptr); g_game.ReleaseItem(oldSplash); postRemoveNotification(oldSplash, nullptr, 0); + onUpdateTile(spectators); break; } } diff --git a/tfs b/tfs new file mode 100755 index 0000000..808167b Binary files /dev/null and b/tfs differ