Honestly, crits shouldn't be too hard to implement, since random damage is already a thing. You just add an extra variable "CritChance" which is equal to (Rand(1,100) + Game->Counter[CR_LUCK]) then write an if statement: if (CritChance >= 100), itemdata->Power = Damage * 2 (where Damage is the result of the random damage roll); else if (CritChance == Game->Counter[CR_LUCK] +1), itemdata->Power = 0 (gotta figure out how to stop botches from stunning, though, without removing stunning from other power 0 weapons); else, itemdata->Power = Damage. For me, the bigger problems are A)Setting enemies up to deal random damage, as well (think I need an array, for that, dunno how to make it) and B) finding a workaround to the "damage dealt is always an even number" bullshit. I'm thinking of just doubling the enemy HP, then halving their actual HP and damage dealt wherever its displayed.... Or I guess I could just activate "1/2 damage" for every weapon type, and let the engine do the rest. Dunno if the second thing will work, though.
EDIT: Yep, it worked. Now to add the crits and extra stat.
FURTHER EDIT: In case you're interested, this is how I implemented it with my swords, tested and functional:
float SwordDamage;
const int SwordPower = 121; //set this to the item id of a whimsical ring-class item with
//a power of 0 and a chance of 1 in 1
const int CR_COPPER = 7;
const int CR_SILVER = 8;
const int CR_BREAD = 9;
const int CR_MEAT = 10;
const int CR_ALE = 11;
const int CR_HP = 12;
const int CR_MAXHP = 13;
const int CR_SP = 14;
const int CR_MAXSP = 15;
const int CR_MP = 16;
const int CR_MAXMP = 17;
const int CR_XP = 18;
const int CR_MAXXP = 19;
const int CR_LV = 20;
const int CR_STRENGTH = 21;
const int CR_INTELLECT = 22;
const int CR_DEXTERITY = 23;
const int CR_CHARISMA = 24;
const int CR_MAXCOIN = 25;
const int CR_LUCK = 26;
int CritChance;
//Relatively easy edits could be used to make this work for any weapon type, rather than only swords
//I'll post that code up when I finish it.
item script SwordRandomDamage
{
void run(int SwMinDam, int SwMaxDam)
{
CritChance = (Rand(1,100) + Game->Counter[CR_LUCK]);
if (CritChance >= 100)
{
SwordDamage = ((Rand(SwMinDam, SwMaxDam) + ((Game->Counter[CR_STRENGTH] - 10) * 0.25)*2));
}
else if (CritChance == (Game->Counter[CR_LUCK] + 1))
{
SwordDamage = 0;
}
else if ((CritChance < 100) && (CritChance > (Game->Counter[CR_LUCK] + 1)))
{
SwordDamage = (Rand(SwMinDam, SwMaxDam) + ((Game->Counter[CR_STRENGTH] - 10) * 0.25));
}
itemdata id = Game->LoadItemData(SwordPower);
id->Power = SwordDamage;
Trace(SwordDamage);
Trace(CritChance);
}
}
Edited by Binx, 27 May 2015 - 01:24 PM.

