CC: No longer rely on received parameter to be 0 (#2870)

This commit is contained in:
aMannus 2023-05-10 15:15:33 +02:00 committed by GitHub
parent 2ea72f835a
commit 23d89122b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -417,6 +417,7 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break; break;
case kEffectFillHeart: case kEffectFillHeart:
effect->giEffect = new GameInteractionEffect::ModifyHealth(); effect->giEffect = new GameInteractionEffect::ModifyHealth();
effect->giEffect->parameters[0] = receivedParameter;
break; break;
case kEffectKnockbackLinkWeak: case kEffectKnockbackLinkWeak:
effect->giEffect = new GameInteractionEffect::KnockbackPlayer(); effect->giEffect = new GameInteractionEffect::KnockbackPlayer();
@ -454,6 +455,7 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break; break;
case kEffectAddRupees: case kEffectAddRupees:
effect->giEffect = new GameInteractionEffect::ModifyRupees(); effect->giEffect = new GameInteractionEffect::ModifyRupees();
effect->giEffect->parameters[0] = receivedParameter;
break; break;
case kEffectGiveDekuShield: case kEffectGiveDekuShield:
effect->giEffect = new GameInteractionEffect::GiveOrTakeShield(); effect->giEffect = new GameInteractionEffect::GiveOrTakeShield();
@ -465,26 +467,32 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break; break;
case kEffectRefillSticks: case kEffectRefillSticks:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_STICK; effect->giEffect->parameters[1] = ITEM_STICK;
break; break;
case kEffectRefillNuts: case kEffectRefillNuts:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_NUT; effect->giEffect->parameters[1] = ITEM_NUT;
break; break;
case kEffectRefillBombs: case kEffectRefillBombs:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_BOMB; effect->giEffect->parameters[1] = ITEM_BOMB;
break; break;
case kEffectRefillSeeds: case kEffectRefillSeeds:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_SLINGSHOT; effect->giEffect->parameters[1] = ITEM_SLINGSHOT;
break; break;
case kEffectRefillArrows: case kEffectRefillArrows:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_BOW; effect->giEffect->parameters[1] = ITEM_BOW;
break; break;
case kEffectRefillBombchus: case kEffectRefillBombchus:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_BOMBCHU; effect->giEffect->parameters[1] = ITEM_BOMBCHU;
break; break;
@ -811,16 +819,6 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break; break;
} }
// If no value is specifically set, default to using whatever CC sends us.
// Values are used for various things depending on the effect, but they
// usually represent the "amount" of an effect. Amount of hearts healed,
// strength of knockback, etc.
if (effect->giEffect != NULL) {
if (!effect->giEffect->parameters[0]) {
effect->giEffect->parameters[0] = receivedParameter;
}
}
return effect; return effect;
} }