Jump to content

Elin:Code Analysis/Unclassified: Difference between revisions

add code analysis for gamble chest
No edit summary
(add code analysis for gamble chest)
Line 83: Line 83:
** '''4.8% Wish''' (if PC meet the requirement)
** '''4.8% Wish''' (if PC meet the requirement)
** 43.2% Plain Water.
** 43.2% Plain Water.
== Gamble Chest (EA23.96)==
{{Version|23.96}}
<syntaxhighlight lang="c#" line="1">
public override IEnumerable<AIAct.Status> Run()
{
this.owner.Say("lockpick_start", this.owner, this.target, null, null);
this.owner.PlaySound("lock_pick", 1f, true);
while (this.target.Num > 0 && this.IsValid())
{
this.owner.PlaySound("lock_open_small", 1f, true);
this.owner.LookAt(this.target);
this.target.renderer.PlayAnime(AnimeID.Shiver, default(Vector3), false);
yield return base.KeepRunning();
EClass.player.stats.gambleChest++;
Rand.SetSeed(EClass.game.seed + EClass.player.stats.gambleChest);
bool flag = this.owner.Evalue(280) + 5 >= EClass.rnd(this.target.c_lockLv + 10);
if (EClass.rnd(20) == 0)
{
flag = true;
}
if (EClass.rnd(20) == 0)
{
flag = false;
}
int num = 20 + this.target.c_lockLv / 3;
if (flag)
{
num *= 3;
EClass.player.stats.gambleChestOpen++;
Rand.SetSeed(EClass.game.seed + EClass.player.stats.gambleChestOpen);
bool flag2 = 100 + this.owner.LUC > EClass.rnd(10000);
if (EClass.debug.enable && EClass.rnd(2) == 0)
{
flag2 = true;
}
if (flag2)
{
this.owner.PlaySound("money", 1f, true);
this.owner.PlayAnime(AnimeID.Jump, false);
Thing thing = ThingGen.Create("money", -1, -1).SetNum(EClass.rndHalf(50 * (100 + this.target.c_lockLv * 10)));
this.owner.Pick(thing, false, true);
this.owner.Say("gambleChest_win", thing, null, null);
}
else
{
this.owner.Say("gambleChest_loss", null, null);
}
Rand.SetSeed(-1);
}
else
{
this.owner.Say("gambleChest_broke", this.target.GetName(NameStyle.Full, 1), null);
this.owner.PlaySound("rock_dead", 1f, true);
}
this.target.ModNum(-1, true);
this.owner.ModExp(280, num);
if (EClass.rnd(2) == 0)
{
this.owner.stamina.Mod(-1);
}
}
yield break;
}
</syntaxhighlight>
* This code defines what happens when you open a gamble chest.
* Winning only grants you orens.
* The maximum orens you can win is (500 × Chest Level) + 5000. For example, if the chest's name ends with +50, based on this formula, you can win an amount between 15000 and 30000 orens.
* The minimum orens you can win is half of the maximum.
* The winning chance is based on the total number of gamble chests opened, allowing players to exploit it through save scumming. For example, if you save your progress, open chests, and win on the 9th one, reloading will always result in a win on the 9th chest.


[[Category:EN]]
[[Category:EN]]
[[Category:Elin Spoiler]]
[[Category:Elin Spoiler]]
2

edits