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

Implements transformation mechanic as a spell effect. #3822

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

walt253
Copy link
Contributor

@walt253 walt253 commented Jan 12, 2025

Implements transformation mechanic as a spell effect.

; The creature it transforms into. Accepts ANY_CREATURE for random but evil will stay evil and good will stay good.
Transform = NULL

Example spell to replace the unused SPELL_LIZARD:

[spell29]
; Transform the user into a Fly for 15 seconds.
Name = SPELL_TRANSFORM
CastAtThing = 0
ShotModel = NOSHOT
SpellPower = NOPOWER
; Set duration to 0 to make the transformation permanent.
Duration = 300
AuraEffect = EFFECT_TINY_SPARKS
AuraDuration = 300
AuraFrequency = 4
Transform = FLY
SelfCasted = 1 25 1
SymbolSprites = 768 770

Example instance:

; This example is for possession only but can be set to be cast under specific conditions using 'ValidateSourceFunc', 'ValidateTargetFunc', and 'SELF_BUFF'.
[instance54]
Name = TRANSFORM
Time = 10
ActionTime = 10
ResetTime = 1200
FPTime = 3
FPActionTime = 3
FPResetTime = 1200
FPInstantCast = 0
ForceVisibility = 100
TooltipTextID = 201
SymbolSprites = 434
Graphics = SCREAM
PrimaryTarget = 3
Properties =
Function = creature_cast_spell SPELL_TRANSFORM 0

The mechanic can also be used offensively. For example, assigning SpellEffect = SPELL_TRANSFORM to a shot will transform the target!

@walt253
Copy link
Contributor Author

walt253 commented Jan 12, 2025

This is built on top of #3821, as it uses the function get_random_appropriate_creature_kind.

Therefore, #3821 should be merged first.

@walt253 walt253 requested a review from benlp91 January 12, 2025 03:07
@walt253 walt253 linked an issue Jan 12, 2025 that may be closed by this pull request
// TODO: Strange condition regarding the fly, check why it's here?
if (!flag_is_set(game.conf.crtr_conf.model[thing->model].model_flags, CMF_IsDiptera))
// Clear 'TMvF_Flying' only if the creature isn't innately able to fly.
if (!crstat->flying)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still don't know why it only checked for diptera, but it makes sense to check for innate flying ability.

'creature_choose_first_available_instance' : Investigate why it doesn't work and only seems to select [instance1] for creatures that don't even know it.
@Dragonlich8
Copy link

Please, can you make some sample for "automatic" and for offensively mode?
Thank you!

@benlp91 benlp91 marked this pull request as ready for review January 12, 2025 09:43
@walt253 walt253 marked this pull request as draft January 12, 2025 09:55
@walt253

This comment was marked as outdated.

@walt253
Copy link
Contributor Author

walt253 commented Jan 12, 2025

Please, can you make some sample for "automatic" and for offensively mode? Thank you!

You just need to give the instance SELF_BUFF with correct ValidateSourceFunc & ValidateTargetFunc to make them use it "automatically", example:

Properties = SELF_BUFF
ValidateSourceFunc = validate_source_generic 0 0
ValidateTargetFunc = validate_target_benefits_from_offensive 0 0

As for the offensive you just need to give to a shot the SpellEffect:

[shot1]
Name = SHOT_FIREBALL
SpellEffect = SPELL_TRANSFORM

Try to add this line SpellEffect = SPELL_TRANSFORM to SHOT_FIREBALL.

@walt253 walt253 marked this pull request as ready for review January 13, 2025 22:40
@walt253 walt253 requested review from benlp91 and removed request for benlp91 January 13, 2025 22:42
@walt253 walt253 marked this pull request as draft January 15, 2025 17:10
@walt253 walt253 removed the request for review from benlp91 January 15, 2025 17:21
@walt253
Copy link
Contributor Author

walt253 commented Jan 15, 2025

In draft, there is more situations to check for original model.

@walt253 walt253 closed this Jan 15, 2025
@walt253 walt253 reopened this Jan 18, 2025
PR isn't finished yet, there is more places to verify if it needs to look for the actual model or the original model.
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.

TRANSFORMATION OF ONE CREATURE INTO ANOTHER
2 participants