Random Battle: Few updates

- Reject Focus Punch, Sucker Punch, and Hidden Power when moves are
processed, not after (if they are the only attacking move)
- Simplify the checks for too many Dark moves by using the new type
counter; this should fix remaining Spiritomb issues as well
This commit is contained in:
The Immortal 2015-11-28 14:13:08 +04:00
parent 50365d9e2a
commit 0b2cb6bda2

View File

@ -1188,7 +1188,7 @@ exports.BattleScripts = {
if (!counter.setupType && !counter['speedsetup'] && !hasMove['cosmicpower'] && !hasMove['substitute'] && !hasMove['wish'] && !hasAbility['Speed Boost']) rejected = true;
break;
case 'focuspunch':
if (!hasMove['substitute'] || hasMove['rest'] && hasMove['sleeptalk']) rejected = true;
if (!hasMove['substitute'] || counter.damagingMoves < 2) rejected = true;
break;
case 'perishsong':
if (!hasMove['protect']) rejected = true;
@ -1246,8 +1246,7 @@ exports.BattleScripts = {
if (counter.setupType || hasMove['substitute'] || hasMove['switcheroo'] || hasMove['trick']) rejected = true;
break;
case 'foulplay':
if (counter.setupType || !!counter['speedsetup'] || (hasMove['rest'] && hasMove['sleeptalk'])) rejected = true;
if (hasMove['darkpulse'] || hasMove['knockoff']) rejected = true;
if (counter.setupType || !!counter['speedsetup'] || counter['Dark'] > 2 || (hasMove['rest'] && hasMove['sleeptalk'])) rejected = true;
break;
case 'haze': case 'healingwish': case 'pursuit': case 'spikes': case 'waterspout':
if (counter.setupType || !!counter['speedsetup'] || (hasMove['rest'] && hasMove['sleeptalk'])) rejected = true;
@ -1299,10 +1298,8 @@ exports.BattleScripts = {
if ((hasMove['crunch'] || hasMove['hyperspacefury']) && counter.setupType !== 'Special') rejected = true;
break;
case 'suckerpunch':
if ((hasMove['crunch'] || hasMove['darkpulse']) && (hasMove['knockoff'] || hasMove['pursuit'])) rejected = true;
if (!counter.setupType && hasMove['foulplay'] && (hasMove['darkpulse'] || hasMove['pursuit'])) rejected = true;
if (counter.setupType === 'Special' && hasType['Dark'] && counter.stab < 2) rejected = true;
if (hasMove['rest'] && hasMove['sleeptalk']) rejected = true;
if (counter['Dark'] > 2 || (counter.setupType === 'Special' && hasType['Dark'] && counter.stab < 2)) rejected = true;
if (counter.damagingMoves < 2 || hasMove['rest'] && hasMove['sleeptalk']) rejected = true;
break;
case 'dragonclaw':
if (hasMove['outrage'] || hasMove['dragontail']) rejected = true;
@ -1417,7 +1414,7 @@ exports.BattleScripts = {
if (counter.setupType || (hasAbility['Refrigerate'] && hasMove['freezedry']) || hasMove['wish']) rejected = true;
break;
case 'hiddenpower':
if (hasMove['rest'] && hasMove['sleeptalk']) rejected = true;
if ((counter.damagingMoves < 2 && !counter.stab) || (hasMove['rest'] && hasMove['sleeptalk'])) rejected = true;
break;
case 'hypervoice':
if (hasMove['naturepower'] || hasMove['return']) rejected = true;
@ -1559,10 +1556,7 @@ exports.BattleScripts = {
let damagingid = counter.damagingMoves[0].id;
if (movePool.length - availableHP || availableHP && (damagingid === 'hiddenpower' || !hasMove['hiddenpower'])) {
let replace = false;
if (damagingid in {focuspunch:1, suckerpunch:1} || (damagingid === 'hiddenpower' && !counter.stab)) {
// Unacceptable as the only attacking move
replace = true;
} else if (!counter.stab && !counter.damagingMoves[0].damage && template.species !== 'Porygon2') {
if (!counter.stab && !counter.damagingMoves[0].damage && template.species !== 'Porygon2') {
let damagingType = counter.damagingMoves[0].type;
if (damagingType === 'Fairy') {
// Mono-Fairy is acceptable for Psychic types