edo9300 / ygopro-core

ygopro script engine.
Other
45 stars 31 forks source link

Renaming script functions for better understanding and less clunkiness #90

Open kevinlul opened 5 years ago

kevinlul commented 5 years ago

EDIT: These are now on the rename-lua branch, thank you Yamato.

Card.IsDirectAttacked -> Card.HasAttackedDirectly
Card.IsHasCardTarget -> Card.HasCardAsTarget
Card.IsRelateToEffect -> Card.IsRelatedToEffect
Card.IsRelateToChain -> Card.IsRelatedToChain
Card.IsRelateToCard -> Card.IsRelatedToCard
Card.IsRelateToBattle -> Card.IsRelatedToBattle
Card.IsDestructable -> Card.CanBeDestroyed
Card.IsSummonableCard -> Card.CanBeNormalSummonSet
Card.IsSummonable -> Card.CanBeNormalSummoned
Card.IsXSummonableCard -> Card.CanBeXSummoned
Card.IsSpecialSummonable -> Card.IsSpecialSummonMonster
Card.IsCanBeSpecialSummoned -> Card.CanBeSpecialSummoned
Card.IsReleasable -> Card.CanBeTributed
Card.IsReleasableByEffect -> Card.CanBeTributedByEffect
Card.IsDiscardable -> Card.CanBeDiscarded
Card.IsAbleToChangeControler -> CanChangeController
Card.IsControlerCanBeChanged -> CanControllerBeChanged
Card.IsCanChangePosition -> Card.CanChangePosition
Card.IsCanTurnSet -> Card.CanBeFlippedSet
Card.IsCanAddCounter -> Card.CanHoldCounter
Card.IsCanRemoveCounter -> Card.CanRemoveCounter
Card.IsCanBeFusionMaterial -> Card.CanBeXMaterial
Card.IsCanBeMaterial -> Card.CanBeMaterial
Card.IsCanBeEffectTarget -> Card.CanBeTargetedByEffect
Card.IsCanBeBattleTarget -> Card.CanBeTargetedByAttack
Card.GetOwnerTarget -> Card.GetAbsoluteTargetGroup
Card.GetOwnerTargetCount -> Card.GetAbsoluteTargetGroupCount

Duel.IsPlayerCanDraw -> Duel.CanPlayerDraw
Duel.IsPlayerCanDiscardDeck -> Duel.CanPlayerDiscardDeck
Duel.IsPlayerCanDiscardDeckAsCost -> Duel.CanPlayerDiscardDeckAsCost
Duel.IsPlayerCanSummon -> Duel.CanPlayerSummon
Duel.IsPlayerCanSpecialSummon -> Duel.CanPlayerSpecialSummon
Duel.IsPlayerCanFlipSummon -> Duel.CanPlayerFlipSummon
Duel.IsPlayerCanSpecialSummonMonster -> Duel.CanPlayerSpecialSummonMonster
Duel.IsPlayerCanSpecialSummonCount -> Duel.CanPlayerSpecialSummonCount
Duel.IsPlayerCanRelease -> Duel.CanPlayerTribute
Duel.IsPlayerCanRemove -> Duel.CanPlayerBanish
Duel.IsPlayerCanSendtoHand -> Duel.CanPlayerAddToHand
Duel.IsPlayerCanSendtoGrave -> Duel.CanPlayerSendToGrave
Duel.IsPlayerCanSendtoDeck -> Duel.CanPlayerSendToDeck
Duel.IsPlayerCanAdditionalSummon -> Duel.CanPlayerSummonAdditionally
Duel.IsCanRemoveCounter -> Duel.CanPlayerRemoveCounter
Duel.SetChainLimitTillChainEnd -> Duel.SetChainLimitUntilChainEnd

Effect.IsHasProperty -> Effect.HasProperty
Effect.IsHasCategory -> Effect.HasCategory
Effect.IsHasType -> Effect.HasType
Effect.IsActivatable -> Effect.CanBeActivated

Unrelated suggestion by @edo9300

GetChainMaterial -> Duel.GetPlayerEffect(tp,EFFECT_CHAIN_MATERIAL)

Suggestions after Dec 10 not included.

lrhel commented 5 years ago

My suggestion:

This seems to still be ambiguous in my opinion but I don't have a better suggestion:

edo9300 commented 5 years ago

Card.CanBeSet is misleading, as it's not clear if that mens the act of flipping facedown, or setting from hand/anywhere else. Card.CanAddCounter too is ambiguous, as the "add" could mean that the card puts counters somewhere

DyXel commented 5 years ago

what about:

Card.CanAcceptCounter -> Card.CanHoldCounter
Card.IsCanRemoveCounter -> Card.CanRemoveCounter

edit: CanHoldCounter idea by Naim

larry126 commented 5 years ago
Duel.IsExistingMatchingCard
Duel.IsExistingTarget

I actually suggest keeping the "Is" part in these 2 functions as they do make grammatical sense.

larry126 commented 5 years ago
Card.IsSummonableCard

This appeared twice in the top list, one of them was possibly meant to be Card.IsSummonable. My suggestions are as follow:

Card.IsSummonableCard => Card.CanBeNormalSummonSet (or IsAbleToNormalSummonSet to indicate that it is different from other summon checks)
Card.IsSummonable => Card.CanBeNormalSummoned

The reasons are 2: 1- It is kept in line with the format of Card.CanBeXSummon. 2- It shows the difference between OCG & TCG. Since "Normal Summon" in OCG means "Normal Summon/Set" in TCG, while "Summon" in OCG means "Normal Summon" in TCG.

DyXel commented 5 years ago

At the beggining i suggested leaving normal summon as just summon, because it makes sense for it to be a default type of summon, but now that you mention the fact that they are called differently between OCG and TCG it would be better to just make the distinction like with all other summon types.

ahtelel commented 4 years ago

Is changing “DiscardDeck” to “Mill” safe?

AlphaKretin commented 4 years ago

I agree that DiscardDeck is a bad misleading name but I’m not sure Mill is the right solution, it’s kind of a slang term.

ahtelel commented 4 years ago

I’m of the opinion that there’s no way to shorten “Send X from Y’s Deck to the GY” to something as short as Mill; while it is a slang term, it fulfills our need to better remember/understand the function and to reduce clunkiness. (Although of course suggestions can be proposed to kill this argument)

kevinlul commented 4 years ago

See rename-lua and PR here for further progress.

kevinlul commented 4 years ago

List for the second wave

Card.IsAbleToHand -> CanSendToHand
Card.IsAbleToDeck -> CanSendToDeck
Card.IsAbleToExtra -> CanSendToExtra
Card.IsAbleToGrave -> CanSendToGrave
Card.IsAbleToRemove -> CanBeBanished
Card.IsAbleToHandAsCost -> CanSendToHandAsCost
Card.IsAbleToDeckAsCost -> CanSendToDeckAsCost
Card.IsAbleToExtraAsCost -> CanSendToExtraAsCost
Card.IsAbleToDeckOrExtraAsCost -> CanSendToDeckOrExtraAsCost
Card.IsAbleToGraveAsCost -> CanSendToGraveAsCost
Card.IsAbleToRemoveAsCost -> CanBeBanishedAsCost
Card.IsAttackPos -> IsAttackPosition
Card.IsDefensePos -> IsDefensePosition
Card.IsControler -> IsController
Card.GetControler -> GetController
Card.GetPreviousControler -> GetPreviousController
Card.SetSPSummonOnce -> SetSpecialSummonOnce
Card.IsMSetable -> CanSetInMZone
Card.IsSSetable -> CanSetInSZone
Card.IsHasEffect -> Card.HasEffect

Group.TakeatPos -> Group.At
Group.IsContains -> Group.Contains
Group.IsExists -> Group.Exists

Duel.Remove -> Duel.Banish
Duel.SendtoGrave -> Duel.SendToGrave
Duel.SendtoHand -> Duel.SendToHand
Duel.SendtoDeck -> Duel.SendToDeck
Duel.SendtoExtraP -> Duel.SendToExtraFaceup
Duel.Sendto -> Duel.SendTo
Duel.RemoveCards -> Duel.BanishCards
Duel.IsCanAddCounter -> Duel.CanPlayerAddCounter
Duel.Release -> Duel.Tribute
Duel.ConfirmDecktop -> Duel.ConfirmTopDeck
Duel.ConfirmExtratop -> Duel.ConfirmTopExtra
Duel.SortDecktop -> Duel.SortTopDeck
Duel.RDComplete -> Duel.RecoverDamageComplete
Duel.DiscardDeck -> Duel.Mill
Duel.ReleaseRitualMaterial -> Duel.TributeRitualMaterial
Duel.IsAbleToEnterBP -> Duel.CanEnterBattlePhase
Duel.CanPlayerDiscardDeck -> Duel.CanPlayerMill
Duel.CanPlayerDiscardDeckAsCost -> Duel.CanPlayerMillAsCost
Duel.MSet -> Duel.SetInMZone
Duel.SSet -> Duel.SetInSZone
Duel.GetDecktopGroup -> Duel.GetTopDeckGroup
Duel.GetExtraTopGroup -> Duel.GetTopExtraGroup
Duel.IsExistingMatchingCard -> Duel.ExistsMatchingCard
Duel.IsExistingTarget -> Duel.ExistsMatchingTarget
Duel.GetLocationCountFromEx -> Duel.GetLocationCountForExtra
Duel.GetReleaseGroup -> Duel.GetEffectTributeGroup
Duel.GetReleaseGroupCount -> Duel.GetEffectTributeGroupCount
Duel.CheckReleaseGroup -> Duel.CheckEffectTributeGroup
Duel.SelectReleaseGroup -> Duel.SelectEffectTributeGroup
Duel.CheckReleaseGroupEx -> Duel.CheckEffectTributeGroupAdditional
Duel.SelectReleaseGroupEx -> Duel.SelectEffectTributeGroupAdditional
Duel.GetTributeGroup -> Duel.GetSummonTributeGroup
Duel.GetTributeCount -> Duel.GetSummonTributeGroupCount
Duel.IsChainDisablable -> IsChainDisableable

The issue of Card.CanChangeController and Card.CanControllerBeChanged is left for later. Also unrelated but Duel.VenomSwampCheck will be deleted.