Fluorohydride / ygopro-core

ygopro script engine.
MIT License
321 stars 135 forks source link

fix Duel.GetFieldGroupCount #602

Closed salix5 closed 2 months ago

salix5 commented 2 months ago

Problem

Duel.GetFieldGroupCount(tp,LOCATION_SZONE+LOCATION_FZONE,0) It will count the same card twice. If A has 1 Field Spell and 1 Continuous Spell: Correct: 2 Now: 3

Reason

Duel.GetFieldGroup(tp,LOCATION_SZONE+LOCATION_FZONE,0) It will put the cards in a set.

Duel.GetFieldGroupCount(tp,LOCATION_SZONE+LOCATION_FZONE,0) It will not put the cards in a set.

Solution

use set in filter_matching_card, filter_field_card

Test

Add the following to the operation function of any Continuous Spell X:

Debug.Message(Duel.GetFieldGroupCount(tp,LOCATION_SZONE+LOCATION_FZONE,0))
Debug.Message(Duel.IsExistingMatchingCard(nil,tp,LOCATION_SZONE+LOCATION_FZONE,0,3,nil))

Activate a Field Spell Acticate X

The result is

3
true

in current version.

@mercury233 @purerosefallen