Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: creatures revision #3263

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

pudimtibia
Copy link
Contributor

@pudimtibia pudimtibia commented Jan 21, 2025

Description

EN: The goal of this project is to fix creature behavior to ensure compliance with ability grouping (spell groups) and to conduct a complete review of all creature aspects: experience (XP), health points (HP), corpses and decay, abilities, damage, loot, dialogues, resistances, and more. The aim is to deliver a more balanced, coherent, and engaging experience for players.

PT: O objetivo do projeto é corrigir o comportamento das criaturas para que respeitem o agrupamento de habilidades (spell groups) e realizar uma revisão completa de todos os aspectos das criaturas: experiência (XP), pontos de vida (HP), corpos e decaimentos (corpse/decay), habilidades, danos, loots, falas, resistências, entre outros. A proposta é oferecer um conteúdo mais balanceado, coerente e envolvente para os jogadores.

Behaviour

Actual

EN: Currently, in Canary, creature spells have individual intervals and chances, which can result in multiple spells (e.g., 4 or 5) being executed simultaneously without respecting group logic. This creates inconsistencies compared to the correct behavior, where spells within the same group should compete against each other. Additionally, aspects of creatures such as loot, spells, damage, HP, XP, dialogues, resistances, corpses, and decay times have not been thoroughly reviewed, leading to imbalances.

PT: Atualmente, no Canary, as magias das criaturas possuem intervalos e chances individuais, o que pode resultar na execução simultânea de várias magias (ex.: 4 ou 5), sem respeitar um agrupamento. Isso gera inconsistências em relação ao comportamento correto, onde magias do mesmo grupo devem competir entre si. Além disso, aspectos das criaturas, como loot, magias, danos, HP, XP, falas, resistências, corpos e tempos de decaimento, não foram completamente revisados, levando a desequilíbrios.

Expected

EN: The goal is to fix creature behavior so that their spells are grouped, ensuring only one spell from each group is executed based on group rules. Furthermore, a comprehensive review of all creature aspects will be conducted, including loot, spells, damage, HP, XP, dialogues, resistances, corpses, and decay times, ensuring consistent balancing aligned with the intended gameplay.

PT: O objetivo é corrigir o comportamento das criaturas para que suas magias sejam agrupadas e apenas uma magia de cada grupo seja executada com base nas regras do agrupamento. Além disso, realizar uma revisão abrangente de todos os aspectos das criaturas, incluindo loot, magias, danos, HP, XP, falas, resistências, corpos e tempos de decaimento, garantindo um balanceamento consistente e alinhado com a proposta de jogo.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Server Version:
  • Client:
  • Operating System: Ubuntu Server 22.04

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

pudimtibia and others added 2 commits January 21, 2025 15:11
Currently, creature attacks ignore group cooldowns. The changes implement spell grouping, and if multiple spells from the same group are selected, one will be chosen at random.
const Position &myPos = getPosition();
const Position &targetPos = attackedCreature->getPosition();

std::map<uint32_t, std::vector<const spellBlock_t*>> groupSpells;
Copy link
Contributor

@mehah mehah Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you do this "grouping" when inserting in mType->info.attackSpells, just order the spells at the end of the insertion. Well, I believe that would be it, I analyzed it superficially.

This suggestion is to mitigate the cost of always creating a map with a vector every time doAttacking is executed.

Copy link
Contributor Author

@pudimtibia pudimtibia Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you do this "grouping" when inserting in mType->info.attackSpells, just order the spells at the end of the insertion. Well, I believe that would be it, I analyzed it superficially.

This suggestion is to mitigate the cost of always creating a map with a vector every time doAttacking is executed.

The isLifeless functionality has been reintroduced, along with a new flag to ensure that spells cast using the old method remain unaffected. My optimization expertise is limited, so any assistance or suggestions for improvement would be greatly appreciated.

Copy link
Contributor

@mehah mehah Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pudimtibia

At first, you just need to check if you have the hasGroupedSpells flag and sort the attackSpells by group.

I think it would be here:

registerMonsterType.attacks = function(mtype, mask)
	if type(mask.attacks) == "table" then
               // maybe
              if mask.hasGroupedSpells then
                  // order by spell group logic
              end

		for _, attack in pairs(mask.attacks) do
			mtype:addAttack(readSpell(attack, mtype))
		end
	end
end

It's better to ask for help from someone who understands this part, I'm not very familiar with Canary.

or even do it directly in c++, it's better to look for the best approach with someone who understands this part that registers monsters through lua.

attackTicks = 0;
}
const auto &attackedCreature = getAttackedCreature();
if (!attackedCreature || (isSummon() && attackedCreature.get() == this)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove isLifeless?
#3186

Copy link

@W4gNII W4gNII Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing lifeless in simultaneous attacks can be make a multiple dies of creatures ... its cannot be remmoved or nedded remake this function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove isLifeless? #3186

Oops, I'll fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it will take some time to be ready, considering that all creatures will be reviewed, I will create a new flag for the creatures

hasGroupedSpells = true,

We check it in the cpp, if it is not there we will continue with the old damage logic. I am making these adjustments and at the same time publishing the changes to the creatures on my live server, this way people can already take advantage of the changes and give the necessary feedback.

@majestyotbr majestyotbr changed the title Creatures revision project fix: creatures revision Jan 21, 2025
@Regeton5306
Copy link

But what's the problem with this? In Tibia RL, they usually always cast 2 spells together. I'm leveling hours in rl and I noticed this when I wanted to copy spells to put them in my ot.

@pudimtibia
Copy link
Contributor Author

But what's the problem with this? In Tibia RL, they usually always cast 2 spells together. I'm leveling hours in rl and I noticed this when I wanted to copy spells to put them in my ot.

Currently, the damage system feels inconsistent, as there’s a possibility for a creature to cast all its spells simultaneously. For example, a Soul War boss could potentially one-shot a player.

At the moment, spells are designed based on interval and chance, but with this new solution, we can increase the spell chances while ensuring turns are properly organized. This adjustment will make hunts more balanced and enjoyable.

pudimtibia and others added 3 commits January 22, 2025 00:33
…tion

The combat logic has been updated to a functional state, though not fully optimized yet. A flag was also introduced for creatures using the new spell system:

monster.flags = {
    hasGroupedSpells = true,
}

This ensures that existing creatures will continue to attack using the original logic.
@lamonato29
Copy link
Contributor

But what's the problem with this? In Tibia RL, they usually always cast 2 spells together. I'm leveling hours in rl and I noticed this when I wanted to copy spells to put them in my ot.

Currently, the damage system feels inconsistent, as there’s a possibility for a creature to cast all its spells simultaneously. For example, a Soul War boss could potentially one-shot a player.

At the moment, spells are designed based on interval and chance, but with this new solution, we can increase the spell chances while ensuring turns are properly organized. This adjustment will make hunts more balanced and enjoyable.

Bro, it cannot be solved using mana in the monsters, or limiting the number of spells to be casted together? Just thinking about it..

@pudimtibia
Copy link
Contributor Author

But what's the problem with this? In Tibia RL, they usually always cast 2 spells together. I'm leveling hours in rl and I noticed this when I wanted to copy spells to put them in my ot.

Currently, the damage system feels inconsistent, as there’s a possibility for a creature to cast all its spells simultaneously. For example, a Soul War boss could potentially one-shot a player.
At the moment, spells are designed based on interval and chance, but with this new solution, we can increase the spell chances while ensuring turns are properly organized. This adjustment will make hunts more balanced and enjoyable.

Bro, it cannot be solved using mana in the monsters, or limiting the number of spells to be casted together? Just thinking about it..

That's the idea, the limitation of attacks per turn.

Creatures that have the new flag hasGroupedSpells = true in this PR will respect the turns

Copy link

Copy link

@Demoncrawler
Copy link

Demoncrawler commented Feb 3, 2025

Is that right, after the demons get updated with this they cannot use the spells in the attackgroup at the same time?
Because clearly in real Tibia they can use for example their beam and the fireball at the same time.
At 8:17 a demon uses energy beam and fireball at the same time.
https://www.youtube.com/watch?v=M1mQIymMIZM
At least for demons this seems very unnecessary

But I did read Falcon Paladin can use only 1 ranged attack at a time, so that creature needs spell groups for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants