KittyTrouble / Ygopro-Card-Creation

Documentation regarding Ygopro card creation
12 stars 3 forks source link

cards type #3

Open BadShun opened 2 years ago

BadShun commented 2 years ago

Hello, my question is i have a monster card which is called "TEN THOUSAND DRAGON" its type is 33554465, so how can i get its categories completely

KittyTrouble commented 2 years ago

Please clarify exactly what you are wanting.

BadShun commented 2 years ago

Please clarify exactly what you are wanting.

I'm a Chinese and my language skills are not very good, I want to know if I know the type of a card is 33445565, how to calculate its category according to your document

KittyTrouble commented 2 years ago

Type as in spell/trap/monster/pendulum or as in Warrior/Dragon/etc?

KittyTrouble commented 2 years ago

33445565 - 16777216 = 16,668,349 (Pendulum) 16,668,349 - 8388608 = 8,279,741 (Xyz) 8,279,741 - 4194304 = 4,085,437 (Toon) 4,085,437 - 2097152 = 1,988,285 (Flip) Etc...

You keep subtracting the largest possible type until there's nothing left. I just don't know what exactly you're trying to do.

BadShun commented 2 years ago

in the spell/trap/monster/pendulum/etc.

KittyTrouble commented 2 years ago

I'm going to tell you now that the number you're asking about doesn't make sense because it's adding every spell/trap icon to a monster card.

BadShun commented 2 years ago

actually i am developing a website to search ygo's card. user input a card's name and it will query the info in cards.cdb and render the card's info in the web for examle "[name]:xxx, [atk]:xxx, [def]:xxx, [type]:xxx" but i dont know how to use the type number which in the cards databases shuch 111 or 222 to translate to the reall type such as spell/trap/monster/pendulum/etc.

KittyTrouble commented 2 years ago

Well it's in powers of 2. So pretend for a moment that there are only 5 types (Monster, Spell, Trap, Effect, Normal) with numbers 1, 2, 4, 8, and 16.

number = 9 Test for number >= 16, if so set it as normal and number = number - 16 Test for number >= 8, if so set it as effect and number = number - 8 (in my example, number would be set to 1 here, 9 - 8) Test for number >= 4, if so set it as trap and number = number - 4 Test for number >= 2, if so set it as spell and number = number - 2 Test for number >= 1, if so set it as monster and number = number - 1 (This would detect it is a monster)

In the end you'd have Monster/Effect represented by 9

The actual values have many more powers of 2, but it's the same principle

BadShun commented 2 years ago

ok,i got it ,thank you very much