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

Improve and fix ranged buffs #3499

Merged
merged 16 commits into from
Oct 3, 2024
Merged

Conversation

Linvail
Copy link
Contributor

@Linvail Linvail commented Sep 29, 2024

This PR contains several bugfixes and improvements.

  • Fix the bug that ranged heal's shot is fired to empty space.
  • Fix the bug that ranged buff be cast on hostile
  • Modify the logic of validating source/target of ranged buff
  • Fix crash when searching creatures for ranged buff
  • Improve validate_target_generic() to exclude the creatures that have been affected by the spell, so that this function could be used for all persisting spell, such as SPEED, ARMOUR.

Type: New Feature

Improve validate_target_generic() to exclude the creatures that
have been affected by the spell, so that this function could be
used for all persisting spell, such as SPEED, ARMOUR.

Type: New Feature
@walt253
Copy link
Contributor

walt253 commented Sep 29, 2024

This is so cool!

However balance-wise this is incredibly OP.

Range speed to anything level 10, if you have a bunch of them it can buff your entire army very quickly and for free.

Maybe we want to tweak the configuration a bit?

Ultimately it's up to the mapmakers sure but coming up with a sensible default won't hurt I think.

@Loobinex Loobinex self-requested a review September 29, 2024 18:41
@Linvail
Copy link
Contributor Author

Linvail commented Sep 30, 2024

For now, we can nerf it by increasing their reset time (cooldown time).

@PieterVdc
Copy link
Member

I know a similar change where spiders would only freeze units that weren't already frozen made said spiders 1 of the best units in game, instead of the garbage without, so yeah do need to take balance into account with a check like that

@Loobinex
Copy link
Member

I know a similar change where spiders would only freeze units that weren't already frozen made said spiders 1 of the best units in game, instead of the garbage without, so yeah do need to take balance into account with a check like that

other buffs have this available too though.

@PieterVdc
Copy link
Member

self buffs rely on cooldown, buffing other units you can have multiple buff same unit, but yeah I guess many units are basically permanently buffed with self buffs as well

The program will crash when there are 3+ creatures being included
in the result list of search_target_generic().
The reason is unclear. It seems that C has special rules for double
star (**) type. It will corrupt the memory when access *pp[i] if
i >= 2 even if *pp was created by malloc() with enough space.

For exmaple:
void fooint( int **pp )
{
  *pp = malloc(100);
  *pp[2] = 9; //crash.
  // It must be rewritten in:
  int *p2 = malloc(100);
  p2[2] = 9; // ok.
  *pp = p2;
}

Type: Bug Fix
@Loobinex Loobinex marked this pull request as draft September 30, 2024 15:56
@Loobinex Loobinex marked this pull request as ready for review September 30, 2024 16:07
* Unconscious creature can't be the target.
* Creature being tortured or kept in prison can't be source, except
  for Ranged Heal.
* Creature being tortured or kept in prison can only heal itself.

Type: New Feature
Sometimes, the ranged buffs is cast on hostile targets because the
ranged buff is mistakenly treated as "weapon" in
get_best_ranged_offensive_weapon() and
get_best_melee_offensive_weapon(const().

Besides, this fix the bug that ranged heal's shot object is fired
toward the hostile.
It is because the target's index isn't set to the caster when casting
a self buff.
For example:
set_creature_instance(thing, inst_id, 0, 0); // Wrong.
set_creature_instance(thing, inst_id, thing->index, 0); // Correct.
The 3rd parameter must be the caster's index for a self buff.

Type: Bug Fix
@Linvail Linvail changed the title Improve validate_target_generic() Improve and fix ranged buffs Oct 1, 2024
@benlp91 benlp91 marked this pull request as draft October 1, 2024 17:48
@benlp91 benlp91 marked this pull request as ready for review October 1, 2024 17:49
@Loobinex Loobinex marked this pull request as draft October 1, 2024 21:58
@Loobinex Loobinex marked this pull request as ready for review October 1, 2024 21:58
If our creatures are imprisoned, it's not reasonable to cast buffs
on them because they are not valid to fight.
But heal is allowed because imprisoned creatures will starve to death
unless they get healed.
If our creatures break enemy's defense and reach the prison, we should
allow our ranged healers to save their allies from death.

Type: New Feature
Currently, the ranged buffs are allowed to fire at nothing.
A SHOT will be fired and it may hit something that we don't want,
for example, unconscious creatures.

This is a waste. The change prevents it. Now unless the player aim
at a valid creature, the ranged buff won't be used.

This change won't affect debuffs or ranged attacks.

Type: Bug Fix
@benlp91 benlp91 marked this pull request as draft October 2, 2024 10:50
@benlp91 benlp91 marked this pull request as ready for review October 2, 2024 10:50
Linvail and others added 4 commits October 2, 2024 19:39
Forbid Ranged Heal to be cast on imprisoned allies per YourMaster's
request to maintain consistency.

Also adjust the reset time of the new ranged buffs. Now they
have the same number as the self buff.


Type: New Feature
In the commit cc405a7, we added the restriction of casting on
imprisoned allies for the creatures, but we didn't address this
issue in Possession mode.

This improves the target selection logic in Possession mode.

Type: Bug Fix
@Loobinex Loobinex removed their request for review October 2, 2024 18:56
@Loobinex Loobinex self-requested a review October 2, 2024 18:56
@Loobinex Loobinex requested review from Loobinex and removed request for Loobinex October 2, 2024 22:41
@Loobinex Loobinex requested review from Loobinex and removed request for Loobinex October 2, 2024 23:26
@Loobinex Loobinex merged commit a9efe06 into dkfans:master Oct 3, 2024
1 check passed
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.

4 participants