Fluorohydride / ygopro-core

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

May I suggest some changes on cards.cpp? #54

Closed Ice-Pendragon closed 8 years ago

Ice-Pendragon commented 8 years ago

I and my friends are happy to make original scripts or play with anime cards, but we found some cards don't act properly because client code returns false although it don't need to be. (Such as ANIME Xianke Magician)

I found some examples, but actually I don't understand codes well. So, I will be glad if you accept these changes, but you'll need to check bugs or latency first.

Thank you for reading.

line 364

uint32 card::get_type() {
    if(assume_type == ASSUME_TYPE)
        return assume_value;
    if(!(current.location & 0x1e))
        return data.type;
    if((current.location == LOCATION_SZONE) && (current.sequence >= 6))
        return TYPE_PENDULUM + TYPE_SPELL;
    if (temp.type != 0xffffffff)
        return temp.type;
    effect_set effects;
    int32 type = data.type;
    temp.type = data.type;

->

uint32 card::get_type() {
    if(assume_type == ASSUME_TYPE)
        return assume_value;
    if(!(current.location & 0x1e))
        return data.type;
    if (temp.type != 0xffffffff)
        return temp.type;
    effect_set effects;
    int32 type = data.type;
    if((current.location == LOCATION_SZONE) && (current.sequence >= 6))
        type = TYPE_PENDULUM + TYPE_SPELL;
    temp.type = data.type;

line 776

uint32 card::get_level() {
    if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL) 
            || (!(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER) && !is_affected_by_effect(EFFECT_PRE_MONSTER)))
        return 0;
    if(assume_type == ASSUME_LEVEL)
        return assume_value;

->

uint32 card::get_level() {
    if(assume_type == ASSUME_LEVEL)
        return assume_value;
    if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL) 
            || (!(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER) && !is_affected_by_effect(EFFECT_PRE_MONSTER)))
        return 0;

line 817

uint32 card::get_rank() {
    if(!(data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL))
        return 0;
    if(assume_type == ASSUME_RANK)
        return assume_value;

->

uint32 card::get_rank() {
    if(assume_type == ASSUME_RANK)
        return assume_value;
    if(!(data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL))
        return 0;

line 859

uint32 card::get_synchro_level(card* pcard) {
    if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL))
        return 0;

->

uint32 card::get_synchro_level(card* pcard) {
    if(((data.type & TYPE_XYZ) && !is_affected_by_effect(EFFECT_SYNCHRO_LEVEL)) || (status & STATUS_NO_LEVEL))
        return 0;

line 871

uint32 card::get_ritual_level(card* pcard) {
    if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL))
        return 0;

->

uint32 card::get_ritual_level(card* pcard) {
    if(((data.type & TYPE_XYZ) && !is_affected_by_effect(EFFECT_RITUAL_LEVEL)) || (status & STATUS_NO_LEVEL))
        return 0;

line 2875

int32 card::is_can_be_synchro_material(card* scard, card* tuner) {
    if(data.type & TYPE_XYZ)
        return FALSE;

->

int32 card::is_can_be_synchro_material(card* scard, card* tuner) {
    if((data.type & TYPE_XYZ) && !is_affected_by_effect(EFFECT_SYNCHRO_LEVEL))
        return FALSE;
DailyShana commented 8 years ago

Sorry, we don't consider effects of animate cards here.

shadowfox87 commented 8 years ago

@Ice-Pendragon We are doing this already on our own server (Percy client). If you're interested in helping out, join the official Discord chat (http://discord.me/ygopro) and contact Edo9300.

Ice-Pendragon commented 8 years ago

@DailyShana Just never mind. :)

@shadowfox87 Interesting. I'll need to see. Thanks.