Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Aphid

Pages: [1]
Translation project / Re: [1.34] Translation Release Thread
« on: June 24, 2015, 10:47:48 AM »
What exactly are you doing to translate the .exe? Hex-editing the file itself for every attempted translation and checking if 'things still work'?

Unfortunately there's something called the Halting problem that makes hand-editing x86 machine code a rather arduous process.

I know a bit about this I can share so that maybe more can help with translating;

First thing you'll have to do is identify the strings used. As a developer, I could be evil and concatenate my strings by induvidual character, or use a RNG to select from multiple variables containing the same text, or some other weird formula, but it's mostly logical to make the units as big as possible, so you have as few of them to work with as you can to keep things simple, and reuse variables. So basically the "it was super effective" message is likely to be a single variable somewhere in the program's memory, and thus you'll find it somewhere in the program. Then the task is to find the thing.

One thing you can do to help your hacker is see if you can create a list of possible byte sequences for every string to be translated, and a list of replacements. (Due to the way Japanese language works there's multiple possible ways of making certain characters through radicals), to make it easier to find these strings. You can find them with any hex editor by searching for the codes. MSFT has information on byte sequences for SHIFT_JIS encoding (codepage 932), and Wiki can be used to find UTF-8 info. E.g. the yen symbol is encoded as 0x818F in JIS, 0xC2A5 in UTF-8, and 0x00A5 in UTF-16. The executable may mix various encodings, we don't know which encoding any particular string is in in memory. You can of course ask the developer for information about the details (but there's a chance they don't know either, as libraries and compilers of programming languages can change this, and many developers don't need or want to know the details about encoding and have libraries 'deal with it').

Now finding the strings is one thing, but changing them is another. When searching short strings, you may find multiple matches. Then trial-and-error is needed to identify which match(es) are actually the strings to be translated, and the matches that are actually other parts of the program. The game is likely to crash when making a mistake, or at least won't show you the translated string.

Machine code can do anything with variables, even re-use it as machine code, so whatever you try to do is not guaranteed to work.  But it's highly likely that the string is just read and passed for rendering, which means you can replace it with any other character sequence, that is the same length. Thus you can only use 'less' characters than the JP version (by using control characters to fill out a string), never more, at least not without a substantial increase in difficulty (reverse engineering). Depending on the encoding used and the character, you can fit 1, 2, 3, or 4 ASCII for each japanese character in your translation on a char-by-char basis. In the end only the total length of the variable matters. 

Actually asking the developer (to export these texts outside of the codebase and into the resource files with a patch) might even be the more convenient option here.   

Metagame Discussion / Re: Puppets with important moves
« on: January 22, 2015, 09:48:48 AM »
Would PIku be a good answer to PAya?

She can switch in freely on Spirit Rock Dance, takes reduced damage from Twister, has access to powerful Electric moves to KO. The question is if she can be made tanky enough to survive a warrior-type attack like Reckless Posture or Rush Attack from aya. I do belive she's going to have problems at x2 or more though.

Touhou Puppet Dance Performance / Re: I can't read Japanese! Where to go?
« on: January 12, 2015, 03:26:11 PM »
I should be more careful when clarifying things:

I intend to say that the 'effect' poison can't be applied to the 'poison' type, and the same holds for the effect 'burn' on a fire type, regardless of the type of the move being used, barring inducing a type change to temporarily make a foe susceptible to the status condition, then using it. Of course, a fire-inducing warrior-type move would fail on a nether-type as well due to the typing of the move; the immunity prevents all effects including non-damaging ones. Or at least this would make sense as a mechanic in a basic way, it is the same way in Pokemon. My explanation is: if -not-, wouldn't the 'fire' effect from Thermit be strictly superior to use compared to Miasma, because it could be applied to anything and everything, while Miasma would not work on steel types only in that case (due to move typing)? I've never managed to poison a poison type in TPDP so far, can that be done (I could've just missed the move a couple times...)?

Also, how does poison trap work then? Can they be absorbed by a poison type or steel type like in Pokemon with the analogous Poison Spikes, or does it function diffrently? 

Touhou Puppet Dance Performance / Re: I can't read Japanese! Where to go?
« on: January 11, 2015, 03:10:31 PM »
67 and 77 do the same thing, the one is hvy poison, the other is hvy burn.

Of course, poison can't be used on poison and steel types, and burn can't be used on fire types and I think 'on fire' might also block it.

Touhou Puppet Dance Performance / Re: I can't read Japanese! Where to go?
« on: January 10, 2015, 01:13:05 PM »
Medicine's skills would be:

Fountain of Youth (命の泉)
Miasma, Skill Card #67
Barrier option (バリアオプション ), Skill Card #64
Spirit Barrier (森羅結界), Skill card #63

This set is basically a Substaller with Ingrain.

Edit: Apparently Medicine doesn't learn Drain Seed, someone just edited the Wiki (I'm taking my info from there about this). I find it quite interesting how it's pretty hard to find a good stalling combo complete on one puppet halfway through the game. 

(Note: Even with Miasma she can effectively stall for 8 turns).

Touhou Puppet Dance Performance / Re: I can't read Japanese! Where to go?
« on: January 10, 2015, 12:55:23 PM »
Wait, discard what I wrote, that may be actually true. Normal types immune to Normal in this game.

Well, you'll have to try something more complicated then. Instead of inflicting Stop with DDaiyousei, you could try a set like this:

- Miasma
- Spirit Barrier
- Barrier Option
- Move of choice
- Glamorous ability

EV's in Defense and HP really help with a set like this. Miasma, Spirit Barrier, and Barrier option are TM's no. 77, 63, and 64 and function like Toxic, Substitute, and Protect. Though 80/80 defenses aren't really great, you could try catching a Yuuka and using her to tank instead of Dai-chan, they're like level 45-50-ish in the wild, which might be good enough with a little bit of extra grinding to run a defensive set incorporating Mana of Grace (マナの恵み) which works like Synthesis (but at 10PP).

Another way of stalling would be DMedicine, also catchable at high level. She can run:
- Fountain of Youth
- Power Drain / Miasma
- Barrier Option
- Spirit Barrier
And stall endlessly by alternating Barrier Option and Spirit barrier after setting up (she will be able to heal continuous barriers for 16+ turns). Note that she can't switch out though.  Another advantage of Medi-chan is her nice low cost of 80, allowing her to level quickly.

Yuuka's field also has the Prismrivers at high levels by the way, who have moves that are 4x effective against PReimu and will instagib her.


Touhou Puppet Dance Performance / Re: I can't read Japanese! Where to go?
« on: January 10, 2015, 11:37:12 AM »
Sandstorm is 「 気象発現「黄砂」 」
And Balancing is 「 差引勘定 」

Make sure your Momiji´s ability is Fair and Square (The one that talks about 1HP)

Reimu is dumb enough to just attack your level 27 and will probably onehit it so it shouldn't be a problem. Note that she can't take any damage before facing Reimu, and you can't just switch her in (she needs to get off Balancing), you have to revenge kill.

Touhou Puppet Dance Performance / Re: I can't read Japanese! Where to go?
« on: January 10, 2015, 11:21:50 AM »
Well, in your case you really have very little offensive power on that team, while not having anything that walls reimu that well except for maybe Daiyousei. This might still help though:

- Have you tried teaching Miasma to Daiyousei and using that instead of stop?

Otherwise, you could go catch a Momiji and learn sandstorm to Renko. Don't level up Momiji. In fact, you may want to reincarnate it and level it to just 19. It gets a move called balancing. Furthermore, Momiji has an ability which allows her to survive with 1 hp. Use 2 puppets to beat reimu, say Chen, and Momiji. Let's suppose Chen is out when Reimu gets sent out and Daiyousei is full HP, and you have sandstorm up. Let Reimu kill chen. Send out momiji. Use Balancing. Momiji will endure the hit and put Reimu at 1hp. Sandstorm activates, and you win.

Now if I could give her balancing at level 1, a shell bell, and some sandstorm weather, we have some OU level 1 aron FUN in thpp.

Actually, let me explain how that works. Supposing it's available, you have this:

Level 1 Momiji
- 12 hp
- Shell Bell
- Balancing

Your opponent has a level 100 -affected by sandstorm- out. They attack. Use balancing, they get put at 1 hp. Sandstorm knocks them out afterwards. Shell bell will then activate, healing up momiji for 10% of the damage dealt, which usually is more than 11, so she is at full HP and her ability can be used again. Continue from there.

Touhou Puppet Dance Performance / Re: I can't read Japanese! Where to go?
« on: January 10, 2015, 10:27:35 AM »
There's a number of things you can do to get the Remu puppet. If i'm correct, Reimu should have some level 60-68 ish puppets, the highest levelled one is Reimu.

Now what you want to do depends on your stance towards these games in general, I need some more information. If you just want to clear Reimu, no restrictions to gameplay, you can simply try to outspeed the Reimu puppet by grinding some levels. Make sure you have a 'sound'-type attack on your anti-reimu puppet. When it comes in, sacrifice your current puppet to it, and bring in your counter. You outspeed Reimu and OHKO with basically any sound move if it's the power variant due to the 4x weakness. As you're high enough level, the Def variant shouldn't be able to KO you back anyway (don't get damage on your sound puppet!). As a note: I used a speed Miko (didn't have Byakuren yet) at this point in the game which came as some nice help against reimu. Now if you want to beat her more 'fairly' by using puppets of the level you should be when facing her (about 50-65 depending on the 'cost' of your puppets and how early you filled out your team), you'll have to have a decent setup for it.

There's many strategies you can do: There's plenty of puppets that can just wall a Reimu, a few stand out:
- DYuuka can hit back hard with After Move, and anything a Reimu form does to her is low damage due to massive FDef.
- DLunasa can switch in to PReimu, tank a second hit, and KO back.
- DKanako, DKotohime and HEirin can stall a Reimu easily in several ways
- Any ghost type can switch in to her Fighting moves.
- Any void type can switch into her Illusion moves.

And there's stuff that's dangerous to her, like:
- PMystia walls fighting moves, and is fast and has STAB sound attacks. She will outspeed after a turn or two as well with Up Tempo.
- AMerlin can also have STAB sound attacks at somewhat less power, and completely blocks Fighting attacks, which you can draw out using a trick detailed below.
- SMiko has a nice typing against Reimu and can hit her with Sound attacks. Also has Up Tempo which means after 1 turn you outspeed Reimu almost guaranteed.
- SYatsuhashi has Resounding Spirit, which means her Void type moves get 1.3x power and become Sound. Because her type is sound, they also gain STAB, which means a 1.95x power boost. So Frenzy Ensemble has 195BP and is at least x2 effective on all Reimu forms. That is rather dangerous. She´s also fast because of being a speed form...

Here's a couple points that can help you:
- Using a fast fire puppet you can inflict the Fox Fire move (Burn & Weakness) on Reimu, crippling her. You can also use Miasma which takes less turns to kill, but you will need more powerful walls then.
- You can stall by using the AI's poor prediction skills: It will always use a super effective move on you if that's available. So if you for example have a DMomiji out when PReimu switches in, PReimu will use a fighting-type move next (guaranteed). A switch to a Ghost type will cause her to waste a turn.
- Spirit Barrier is useful to stall further.
- Use entry hazards: If you're trying to kill her with plain damage and can't quite get enough, try using Mine Trap while one of her other (less dangerous) puppets is out.  This will get you some initial damage on Reimu. Better still, Reimu has no puppet that can absorb Poison Trap which you can exploit as well.
- Drain Seed is incredible vs. the AI for obvious reasons (it won't switch usually). 
- If all else fails, there's always WTF-Boom (Absolute Devotion). That will kill pretty much anything.
- Level 19 Momiji -- Fear ARON tactics.

By the way, if Reimu is being troublesome to you, better prepare, because Shinki&Co which come after the cave you get after Reimu are much harder to beat.


Touhou Puppet Dance Performance / Re: need help @ SDM
« on: January 08, 2015, 08:36:36 PM »
If you need help with fights, there's a single th I can wholeheartedly recommend for the entire story, just because she's amazing: Keine.

1) Can catch very early (human village grass)
2) Steel is excellent typing against the common dark and wind types, useful against elite four Shinki too.
3) Good but not great basic movepool, but some TMs might help you here.
4) Low 'cost' means she gains levels much faster than expensive stuff like flan. For a no-grind run you'll really want a low-cost team (80-90 cost puppets are the best, needing only 700k and 850k to 100 respectively. If you use only 80 cost stuff and get everything early game, you will be L100 by the time you get to the endgame stuff like letty).
5) Good defense stats allow her to switch in, take damage, SD once, switch to hakutaku form, and sweep with the boost in speed and attack from her transformation against many if not most opponents.

Alternatively, if you don't like the headbutting school teacher, you can try the doll hikko (Alice) or the mouse (Nazrin) as a steel type, both can be obtained early on. Take note that in most cases, the worst threats are focused attack based. (that's especially true if you decide to run a cleric orange or some such support, spread walling seems to be easier). Speed shinki is also fun with her Dark Clothing, but expensive at 120. There's a lot of mons that won't be able to touch her in the story mode though. It is also certainly advisable to get an earth mon in your team: the Elite Four use a lot of fast or bulky electric types like Iku, Futo, and Marisa, that can really annoy many teams.

And if there's something to avoid, it's probably Nether types, especially slow ones. Yes, you can hit a lot of stuff normally effective, but you're slower and carry some very commonly used weaknesses (at least in the campaign).

As a personal anecdote, I beat the game using the BBA team (Yuyuko, Yukari, Eirin, Kanako, Hijiri) plus Keine while missing like 80% of the useful TMs, and that didn't really make things very easy, as you end up underleveled and have a slow stally team which means taking a lot of hits. Some tactics might help you too instead of just straight-up attacking (E.g. I made a substalling HEirin which did wonders after I got trashed by Yumeko a couple times and beat her that way -- no PP no moves).  Also fun fact: My yuyuko basically did nothing and just ate XP all game, and sometimes tanked something for a double switch. Omnomnom.

In hindsight the better puppets to get are probably just stuff like Keine, Mystia, Wriggle, Cirno, Orange, and maybe some Baton Pass goodness, but the less attacking moves you have, the more you will have to go back and heal, depend on repels and stuff, which makes things take longer too, so I'm a bit on the fence about BP chains. They do make beating trainers trivial because the trainers are predictable and usually don't pack/use (p)hazing. Definitely don't go full attacker only stupid mode, you can do that in pokemon, not very much in this game though, stuff carries threats to you esp. later on unless you totally powerlevel everything. Much easier to find the right setup fodder, set up and sweep as a tactic.

Touhou Puppet Dance Performance / Re: Suspect List Topic
« on: January 05, 2015, 08:42:59 PM »
I sincerely hope that the amount of restrictions that need to be placed on the game is minimal, in an ideal case, none, for a good battling environment. Indeed literally almost every puppet in this game has some sort of 'unfairness' built into it, something that allows that puppet to break the rules as it were and soak up more damage, deal more damage, be faster, and so on than a puppet would usually be in some circumstance. It is not really a question of whether something can get an advantage in some situation, but rather the following more 'meta'-oriented questions:

1) Is the unfairness pronounced enough?
2) Is the amount of resources required to allocate to the strategy low?
3) Does the one gimmick require highly specific counter strategy from the opponent?
4) Is the unfairness rather unique and come from one ability, puppet, move, etc. combination?
5) Would the competitive game, with this one thing removed, actually become more diverse instead of less diverse?

If the answer to most of these questions is 'yes', that puppet, move, whatever is something suspect.

Some explanation of the finer points:
2) Some strategies will obviously net you benefits, such as a weather team or a baton pass team. The thing is such a team will be less equipped to deal with general threats because the large amount of requirements to execute the strategy, and thus such a strategy netting greater returns in return would be a fine gambit to take, even necessary for such a specific thing to be a viable strategy. When something that has comparable benefits yet comes from far less investment appears is where the danger lies.
3) For example, let's take that specific move that cancels weather and gets more power from it. Would the mere existence of Mary force a move slot to be such-and-such move on teams without her or be uncompetitive? This seems rather restrictive.
4) Here's a good example. There's abilities for each type that turn void moves into that type, at 130% base power. As return is a 100 power move, access to a 130 BP 100% accuracy STAB move is widespread in the puppet pool (but you do trade up your ability slot to do so). In the older Touhoumon games 'good' base power is closer to 90, so Yumeko's ability to basically have 125 BP moves seems unfair, until you realize that it's actually not that much anymore.

Side note: If there's anything I've noticed playing through the game it's this. Came to me as something of a shock, as I'd been running through the game with 60-80 base power on most of the types I had as the highest most of the time, thinking that was actually as 'good as it's going to get'. It seemed to do okay damage, but you can tell I was a bit surprised by finding out it's this much more about offense. Bit disappointed to be honest, as the wide array of support moves might see little use and we just get attack move or switch all the time. I guess when my full defense Yuyuko started to get oneshot by x2 effective things was when I noticed my opponents might be using some stuff with more 'oomph' to it (which I got later on, but was then hidden under roses and in caves and whatnot in skill cards that are hard to find)

5) This actually is the best criterion by far. E.g. take original pokemon. Start competitive battling. First thing you notice: 99% of good teams run Mewtwo, other psychic types see very little use, except for Mr. Mime. Remove Mewtwo, and you see usage of Alakazam, Gengar, and Hypno (in order of popularity) happen. In a very simple sense, the amount of actual 'options' afforded to the players is increased, and each has its pros and cons, it enriches the game. In the very other extreme, if we removed everything except Magikarp (because everything else is so much better than it), this would drastically 'reduce' the diversity, we removed too much. Not removing mewtwo, we definitely removed 'too little'.

Please go ahead and experiment, see if you can come up with some crazy shenanigans that are really hard to deal with properly.

Touhou Puppet Dance Performance / Suspect List Topic
« on: January 05, 2015, 11:59:06 AM »
This is a list of puppets that seem really powerful, to the point where every team needs to dedicate their strategy to beating them, or which might have a very undesirable effect on the game by existing (Moody comes to mind). When/if stuff is being investigated, perhaps interesting to look here first. As moveset information is not fully available yet this should be taken as a tentative list, additional puppets are to be added and removed as more information becomes available and playtest data is gathered. In most cases, it seems that the 'ability' of the puppet is the thing that is most worrisome, there are a few really good ones.


Nimble as an ability doubles a statistic. Doubling a statistic is the same as adding a whole lot of BST to your puppet, effectively 50 plus the value of the stat being doubled.

Power Sakuya

Nimble gives her effective 635 BST, but she can't carry items. She outspeeds almost anything, the exceptions being weather puppets, Yamame, and her own Speed variant, and has an excellent 135 base ATK (only 8 puppets have higher attack). Also has a good movepool, with several coverage options, and of course access to stat-enhancement to top it all off.

Power Yamame


Moody raises stats by +1 each turn. Since the stat being raised is random, it could be evasion. If it is evasion, Moody can cause a lot of trouble, becoming a truly unrivalled stalling ability. It is present on 5 puppets. Especially Suwako, Kokoro, and Komachi seem dangerous users.

Speed Suwako
Power Komachi
Defense Kokoro
Defense Kotohime
Assist Kosuzu

Up Tempo

The TPDP equivalent of Speed Boost, this ability instantly landed Blaziken into Ubers when added to it. Speed Boost was previously only attainable by the very fragile and otherwise quite useless Ninjask, which ended up being a popular lead anyway because of it. Anything with access to speed boost and especially also Backup Plan is automatically suspect. This ability is present on 6 puppets. Notice how 4 of these are power forms which have high damage output. These are dangerous in particular when they have access to attack boosts and/or backup plan:

Speed Miko
Power Rin
Power Kana
Power Cirno
Power Mystia
Assist Merlin

Boundary Blurrer / Power Mary

Present only on Power Mary, Boundary Blurrer doubles 4 statistics in all weather conditions, giving her a 675 effective BST in weather. If weather happens to be somewhat prevalent, Mary might be 'too good', her power is comparable to that of legends in Pokemon. Her Illusion typing gives her only 2 weaknesses, one of which is her own type.

Assist Satori

She is basically Wobbuffet. She can pretty much wall and lock a very high percentage of the puppets, generally getting a 2-1 trade.

Vanishing Act

If Evasion Clause is standardized, Vanishing Act might be criticized as well. Note that it is only present on four puppets, none of which are actually defensive by nature.

Power Remilia
Speed Remilia
Power Wriggle
Assist Wriggle

Divine Protection

Divine Protection is another interesting ability with a lot of potential. Many stat-boosting moves exist that also lower another stat because they would be unfair otherwise. This ability also synergises with Moody.There is only one user.

Speed Sanae

High Stats

While stats are less variable than they are in pokemon, the puppets do vary in stat total from about 450 (barring a few exceptions with abilities to counteract it) to 600.


Both Power and Speed Shinki have a BST of 600, which is the third highest in the game. (Two puppets have a BST of 630, but they have a crippling ability that will probably prevent them from ever seeing much play in either case.). Furthermore, All-Weather and Dark Clothing are both interesting abilities.

Fast and powerful

Puppets have a rather unique combination of very high speed and very high attack. Most other puppets with 120+ attack are slow. Depending on the movesets available, they might cause overcentralization. A comparable pokemon would be Garchomp.

Speed Tojiko
Speed Gengetsu
Speed Yorihime


1) Updated Satori's Information to reflect struggle war fix.
2) Removed Divine Protection from suspect list -- If it only functions for the user, it is far less unfair. Can someone else confirm these findings too?

Touhou Puppet Dance Performance / Speed Tiers
« on: January 05, 2015, 10:24:05 AM »
I made a little spreadsheet with the speed tiers for all (Max EV, Nature) Touhoumons.

As far as I know, the formula seems to be 5 + 2 * Base + EV + IV, where IV ranges from 0-15. This means your stats should be one point higher at lv. 100 than the equivalent Pokemon stats. This comes into play with rounding at times for looking to outspeed things.

The way to read the spreadsheet is to look at the column. For example, let's take a Speed Shinki which uses Intimidation (Known in regular Pokemon as Dragon dance or DD). It's got 95 speed, filling that into the ' my speed' box gives us a base of 225 to start with. If we want to outspeed everything except weathers, sakuya, and aya at +1 speed we need 271 speed. So a speed EV of 46 is good enough if we want a SAtk nature, for a spread of 46 speed, 64 SAtk, and 20 HP to outspeed most stuff after a single use of Intimidation.

Note: There might be some commonly competitively used puppets that will reasonably always run less than full EVs and no speed nature. In that case it might be relevant to include the specific case as another tier, but it is simply to early to tell what/when will happen, so only the 'max' speeds are included here.

General Metagame / Re: Calculating Defensive EV spreads
« on: December 13, 2014, 02:42:50 AM »
Sorry about the double post, but I do have to ask what this 'certain constant' is? I can't solve the Effective HP problem unless I know what C is supposed to be.

Also how to calculate Ed, and Es. You never said how to calculate those either.

Also how did you get from 400 EVs to "368 'points'" left in case three when you spent 132 EVs?

I really think you should put the formula above the example equation so that people here can know what's going on.


While I'm able to understand most of what's going on now, I do wonder what you would do if you got into a case where HP and Def are close together. Now for example, Defense Meiling has base HP of 110 and base defense of 120. Now by the formula, she's technically h > d, but the problem is you could never equalize Defense and HP with her, even with a +def nature due to how much HP she has. And what if you wanted her to be a sort of mixed wall? Her bulk is 110/120/80 which isn't bad at all. How exactly would you calculate that?

Let me answer the points one by one:

First, it does not really matter what C is, that is the entire point. It is a simple multiplier that the game tuned to some constant factor to all attacks. We can't really modify this. C is certainly low enough that attacks don't generally one-shot things, and generally high enough that attacks do enough damage to matter over other more passive sources of damage (poison, leech seed) or healing (such as leftovers) in a way that makes them relevant, without making defenses irrelevant. No matter what the value of C is though it will not affect the 'relative' balance of defense and HP. The optimal mix for your situation remains the same (unless you are looking to ensure survivability against something really specific).

Ed, Es are basically 'EVs spent into defense and special defense', those are the two variables we 'want to know', but don't know yet. There's some assumptions (maximize a certain numerical quantity, assume they are between 0 and 512), and under those assumptions, I built a rudimentary mathematical model that results in a valid answer that satisfies all of them. It's most certainly not a full rigorous answer, but that would not really serve much of a purpose to make it easy to calculate optimal EV's.

The 400-368 thing is a good catch, it's supposed to be 500. I changed it to a more realistic number when I figured out that even at 500 I would get all of the interesting scenario's without bumping into 252-limits. (Where you basically have to put the rest of the defense EV's into suboptimal places). Edited original post.

Now to understand "split equally", let's see it this way:

Say I do 10000 special, 10000 physical damage, you get 100/100 defenses, and C = 1. Then I do 200 points of damage. If I allowed you to spend X points and distribute them between def and sdef, what is optimal?
Define d the defense points, and s = X - d is special def points.

Damage you take is 10000 / (100 + D) + 10000 / (100 + X - D). Take the first derivative towards D, equate to 0, solve, and your answer will be D = 0.5X to be a critical point. Some visual inspection of the function (try putting it into wolfram alpha for some sensible values of X such as say 20) shows you that this critical point is a maximum. It makes a lot of sense too. The lower your defense is, the more damage block you gain from a single point of it. Raising defense from 40 to 100 (like say Chansey does) is very effective at stopping physical damage, it makes her twice as good against this form of damage. But investing special defense from 400 to 460 yields less. The same logic holds for HP and defense when you want to look at only one form of defense. So the optimum thing to do (before natures are taken into account) is to balance the two equally. For the problem with three variables (adding HP ev's into the problem as well) you need Lagrange multipliers to fully solve, and I solved some simplified corner cases with additional assumptions in the main post that should cover most of your needs. A full solution is probably going to need some sort of script to do the math for you because that can get a bit tedious otherwise.

The three scenario's should cover most of your basic EV spread needs. What the data shows though is that the actual optimization is a bit less straightforward than just maxing HP. First, you should take a look at the stats for your puppet. Most puppets will have skewed stat distributions. Then you should ask what you want to build for. One type of attack in particular, a balance, or cover weaknesses? There's some tradeoff being made. E.g. equating DEF to HP point for point gives you the best physical defense, but not the best general defense (unless special defense is stupidly high). The other important parts are those 'critical points', where the optimal strategy to distribute further points changes.

I would also like you to more carefully consider the puppet list before dumping HP. The separating line is narrower than you might think. For example, in order to have 'Excess HP' hp stat needs to be above 'twice'  your defense stat. That's not as much as you think because of the 100 base bonus hp that everyone gets that helps this stat along. Here's some puppets that may want to forego HP for more defense (apart from orange, kaguya, and d.Satori):

- Eirin
- Namazu
- Kogasa
- Sara
- and many more

For example, with a HP stat of 140, that's 421 base HP before EV's. You will need defense stats of at least 210 before investing in hp becomes sensible at all over your defense stat(s) of choice, which is 88 base defense / special defense. There's actually quite a few puppets with more hp/less defense than this. Here's a list of values where you get that 2:1 distribution (for mixed walls).
Code: [Select]
160 | 98 | 114
150 | 93 | 109
140 | 88 | 104
130 | 83 | 99
120 | 78 | 94
110 | 73 | 89
100 | 68 | 84
 90 | 63 | 79
 80 | 58 | 74
 70 | 53 | 69
 60 | 48 | 64
 50 | 43 | 59
 40 | 38 | 54
 30 | 33 | 49

Read the table as follows: This table is for mixed walls. When your puppet's HP is the indicated number, look at its defense stats. If they're above the second number (so say 68 for a 100 HP puppet) then HP is the most efficient stat initially. If defenses are above the third number, then even at 252 HP Ev's you would still value the 253rd HP EV above a defense EV. If defenses are in between, you will need some kind of mix (refer to the first post).
There's actually quite a few puppets where the following is true:
- HP is more or Defenses are both less than the indicated stat.
In that case defenses trump HP. It's not just orange and kaguya.

General Metagame / Calculating Defensive EV spreads
« on: December 08, 2014, 02:58:27 PM »
I see fairly often that guides feature suboptimal defensive EV spreads.

The purpose of defensive EVs is often one of the following three goals, in order of how common they are:

1) Maximize defenses against a chosen type of attack.
2) Maximize defenses against a mixed 'barrage' of attack.
3) Maximize defense against an opponent that picks the most effective type.

In order to understand defensive EVs, let's first consider the attack damage formula. Effectively, this formula says the damage percentage from an attack is 100 * A * P * C * R/ (D * H), where A is the attacking puppet's attack stat, while D is your defense stat. P is the move's power, C is a certain constant, and R varies between 0.85 and 1 randomly. (Both puppets are assumed to be level 100). Since only 'D' and 'H' here is within our control we can observe a simple fact:

EHP = D * H * C

Where EHP is your `effective` health. The higher this number, the more attacks a puppet can withstand. Now EV's raise the 'H' and 'D' statistics by exactly one point per 4 EVs.

Goal <1>

When D > H, it is obvious raising 'H' by one point will provide you with more EHP than raising 'D' by one point, so it is best to spend your EVs in the lower of the two values. There is some 'optimal' amount of EVs to invest in either attack or hp before reaching the cutoff point. Let h be your HP stat, and d be your defense stat. The cutoff point is at d = h + 52.5.

Suppose d < h + 52.5. Then we need more defense. So first invest (h  - d) * 8 + 420 EV's into defense, then split equally.
If h < d - 52.5, then we need more HP. First invest (d - h) * 8 - 420 EV's into HP, then split equally.

Let's do an example: We have a puppet with the following stats:

HP: 80
DEF: 140

And we want to maximize physical defense, having 240 EV's available for this in our build. In order to do so, notice how h < d - 52.5. (d - h) * 8 - 420 = 60, so first invest 60 EV's into HP, then split equally. Then you get the following EV spread:

HP: 150
DEF: 90

Because EV's are rounded in multiples of 4, we can optimize for rounding by using this instead:

HP: 152
DEF: 92

Now, suppose we have a +def nature. By using that spread, the actual value ends in a '9' before nature (339 HP, 339 def). So we can win an extra +1 defense point by investing 4 extra EV's into this, which is very much worth the investment. So the final EVs become:

HP: 148
DEF: 96


For the more 'complicated' goals mathematically it can be very useful to convert base stats into actual real stats, as we can work with real stat points instead of having to work with base stats, which makes the formulas much more complicated, introducing a lot of extra terms. Convert a base stat into a real stat like this:

HP: H = h * 2 + 141
Others: X = x * 2 + 35

Goal <2>

In order to satisfy goal <2> we want to maximize the following, letting HP = H, Defense = D, Special Defense = S:

H / (1 / D + 1 / S)

Under this condition, we can express H = h0 + Eh, D = d0 + Ed, S = s0 + Es, where h0 = 8 * h + 564, and d0 = 8 * d + 144, similar for s0. The formula becomes:

(h0 + Eh)(d0 + Ed)(s0 + Es) / (d0 + Ed + s0 + Es).

This formula can be solved using the method of Lagrange Multipliers, but this is quite more complicated than strictly necessary. First, observe that if d = s or D=S, we have a simple case. At this point, we want to invest in HP as long as 2 * H < D = S, in other words, the turning point is now at:

d = h / 2 + 17.5

So, when:

d < h / 2 + 17.5
D < H / 2

Invest into defenses until this formula is no longer satisfied, then invest 2 EV's into HP for every 1 EV into defenses.

And, when:

d > h / 2 + 17.5
D > H / 2

Invest into health until this formula is no longer satisfied, then invest 2 EV's into HP for every 1 EV into defenses.

Now we turn to the more complicated case. What if D < S (the opposite case is a mirror, so we may assume that 'defense' is the lower of the two defenses).

Solving for H we get:

H = D*D / S + D

And for D:
D = 0.5 * (-S + sqrt(S^2 + 4 * H * S))

If H > D*D / S + D invest EV's into Defense
If H < D*D / S + D invest EV's into Health.

Note that S here is the special defense 'before' any nature benefits.
At this point, natures do matter. Because the sequence of application of EVs does 'not' matter we want the 'most' EHP (if we pick a defense nature) out of it as possible. We can do so by checking whether the 'low' or the 'high' defense stat is a better pick. This involves solving the formula (1 / (1/(ax) + 1/b)) / (1 / (1/a + 1/(bx))) > 1, for which the conclusion is that the 'high' stat is the better pick (not really a weird conclusion there). However, as for the valuation of the low stat and the distribution of EVs, it stays of course the case that nature should be ignored due to the way it works (as a multiplier)  for optimal results, which results in an eventual stat spread of (given enough EVs to work out the kinks in the natural spread) 2:1.1:1, where the 1.1 is in the higher starting def. However, in most cases the natural deviations from the ideal spread are big enough that we can only approach it, and the way most effective to do so as a procedure is best illustrated with examples.

Let's do an example now for case <2>. Suppose we have a 'mon with the following stats:

300 EVs to invest in defenses.
HP: 150
DEF: 100
SDEF: 150

This yields the following 'base real stats':

H: 441
D: 235
S: 335

So we calculate our target HP for the given Defense and Special defense:

H = D^2 / S + D = 235^2/335 + 235 = 400

So we are basically overspent on HP and investing in 'def' is the more efficient choice. So apply the reverse formula:

D =  0.5 * (-S + sqrt(S^2 + 4 * H * S)) = 252

This means the first 68 EV's should be spent in 'Defense'. After this, we have the following stat spread:

H: 441
D: 252
S: 335

Now in order to maximize gains we have to divide EV's between defense and HP in a peculiar way, namely to follow the curve H = D^2 / S + D. At this point we have to solve for both H and D given the constraints. Our constraints are:

S = 335
D = 252 + 1/4x
H = 441 + 1/4v - 1/4x
Subject to:
H = D^2 / S + D

Where v is the total remainder EV we want to invest, and x is the amount of defense ev's. The amount of HP ev's then obviously is x - v. Note that S > D + 63, so we're never going to reach the point where investing in special defense is worthwhile. The solution for the eq. is:

x = 2 sqrt(335) sqrt(v + 4112) - 2348) = 64.666

Rounding down to a multiple of 4 we get 64 extra defense EV's, and 232 - 64 = 168 HP EV's. 64 + 68 = 132, so our final spread is:

HP: 168
DEF: 132
Nature: +SDEF

This spread will give you the most effective health against a 50/50 mix of damage given the provided stats.


If defense and special defense are 'close together' you will need to see if you have enough EV's that defense = special defense when following the quadratic formula obtained as a solution to the problem. At this point HP will be 2* defense as well (due to the way the formula was derived). If this is true, then we can simply forego any further calculations, and start from that point using the 'simple' solution (for def = sdef).

Remark #2:

It is possible to solve the system directly. In this case, we have:

H*D*S / (D*S)
Under the constraints:
D = D0 + 1/4d
S = S0 + 1/4s
H = H0 + 1/4h
d+s+h = v
d >= 0
s >= 0
h >= 0
0 <= v <= 512

But since we've covered all possible sensible cases, the only reason to bother with lagrange techniques here is as a math curiosity.

Edit: Changed notation. Now using capitals for all final stats and small letters for ev's and base stats.

Case <3>

An observant reader will notice a similarity between this and case <1>. Simply pretend the higher defense stat does not exist and treat it as case <1>. Are the defense stats close enough that investing your allotted EV's will balance them out? Then split the remainder as per the simple case <2>. There is one exception which we will come to later.

Let's do a simple example for this special scenario:

HP: 130
DEF: 80
SDEF: 70
EV to spend: 500

This yields the following stats:
HP: 401
DEF: 195
SDEF: 175

First, we equalize the defenses. so spend 80 to SDEF. Then we need an additional 6 points in both defenses, and 1 in HP to get the 2:1:1 distribution, spending an additional 24 in both defenses, and 4 in HP. This yields:

4 HP
24 DEF
104 SDEF
Total spent: 132.

There are now 368 points left. 368 / 4 = 92, so spend another:
184 in HP
92 in DEF
92 in SDEF

For a total of:
188 HP
116 DEF
196 SDEF

Which means stats of:
448 HP
224 DEF
224 SDEF

Now comes the exception, which is 'natures'. This is rather a bit annoying as you see, we can't simply ignore nature here. If we use a boosting nature, then it makes the most sense to boost the lowest defense if they are far apart (for it is impossible to equate the defenses using EVs). However, once it becomes possible to equate the defenses with EV's there's a certain 'tipping point' where you will want the higher def to be chosen for the nature, and then a second tipping point where it won't matter which one you choose. When there's a boosting nature, equalize the defenses after applying the nature.

In order to get 11 defense and 11 special defense, we need to spend 21 points. In other words, we get a 22/21 deal here (22 points for 21). So the ideal distribution 'WITH' a nature for balanced defenses is 21:11:11 if we're behind the second 'tipping point'. Before the first 'tipping point' the ideal distribution is 2:1.1 (the higher def stat doesn't matter).

Finding the first 'tipping point' is quite simple: As soon as the lower defense stat exceeds the higher with both nature and EV's we are in trouble. The same with the second 'tipping point': if we can't equate the lower nature to the higher with a nature applied using EV's, we are in trouble.

Tipping point 1:
1.1 * D + Ed > S

Tipping point 2:
D + Ed' < S * 1.1

Where Ed is obtained using part '1' technique and Ed' is obtained using part '2' technique

In between (when both equations are true), the answer is quite complex.




Pages: [1]