Elin:Code Analysis/Unclassified: Difference between revisions

From Ylvapedia
No edit summary
 
Line 74: Line 74:
** If the well is polluted, debuff will be applied to the PC.
** If the well is polluted, debuff will be applied to the PC.
** If the well is clean, it is as if the PC drank real water.
** If the well is clean, it is as if the PC drank real water.


* Overall Chances for non-holy, non-polluted well:
* Overall Chances for non-holy, non-polluted well:
Line 80: Line 81:
** 16% 1 of 7 type of Bad effect on PC
** 16% 1 of 7 type of Bad effect on PC
** 16% Random Mutation on PC
** 16% Random Mutation on PC
** 4.8% Wish (if PC meet the requirement)
** '''4.8% Wish''' (if PC meet the requirement)
** 43.2% Plain Water.
** 43.2% Plain Water.


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

Latest revision as of 15:09, 27 December 2024


This page is designed to feature code analysis that are currently unclassified into other pages, either due to being too minor detail, or don't have enough stuff to justify having its entire page.

Material in this page will be moved into other pages constantly. Please refrain from linking wiki articles onto this page.

For authors: Please note the version of game tested on for each section added.

Drink from well (EA23.67)

Version EA23.67: This article is behind the latest stable release of Elin, but maybe close enough to be reliable.
public override void TrySetAct(ActPlan p)
	{
		p.TrySetAct("actDrink", delegate
		{
			if (Charges <= 0)
			{
				EClass.pc.Say("drinkWell_empty", EClass.pc, owner);
				return false;
			}
			EClass.pc.Say("drinkWell", EClass.pc, owner);
			EClass.pc.PlaySound("drink");
			EClass.pc.PlayAnime(AnimeID.Shiver);
			if (IsHoly || EClass.rnd(5) == 0)
			{
				ActEffect.Proc(EffectId.ModPotential, EClass.pc, null, (!polluted && (IsHoly || EClass.rnd(2) == 0)) ? 100 : (-100));
			}
			else if (EClass.rnd(5) == 0)
			{
				BadEffect(EClass.pc);
			}
			else if (EClass.rnd(4) == 0)
			{
				ActEffect.Proc(EffectId.Mutation, EClass.pc);
			}
			else if (EClass.rnd(EClass.debug.enable ? 2 : 10) == 0 && !polluted && !EClass.player.wellWished)
			{
				if (EClass.player.CountKeyItem("well_wish") > 0)
				{
					EClass.player.ModKeyItem("well_wish", -1);
					ActEffect.Proc(EffectId.Wish, EClass.pc, null, 10 + EClass.player.CountKeyItem("well_enhance") * 10);
					EClass.player.wellWished = true;
				}
				else
				{
					Msg.SayNothingHappen();
				}
			}
			else if (polluted)
			{
				EClass.pc.Say("drinkWater_dirty");
				BadEffect(EClass.pc);
			}
			else
			{
				EClass.pc.Say("drinkWater_clear");
			}
			ModCharges(-1);
			return true;
		}, owner);
	}
  • These code explains what happens when you drink water from well.
  • These effects will be applied step by step.
  • In 1/5 chance, potential of a main attribute will increase (50%) or decrease (50%).
    • This will be forced to trigger if it i a holy well, and will be 100% increase.
  • Then in another 1/5 chance, bad effect will be applied to the PC, with equal chance of being one of the seven: Blind, Paralyze, Sleep, Poison, Faint, Disease, Confuse.
  • Then in another 1/4 chance, a mutation will be applied to the PC.
  • Then in another 1/10 chance, and when PC hasn't wished in this year, and when the well isn't polluted, a wish is granted.
    • This chance is increased to 1/2 if user in debug mode.
    • The strength of wish is 10 + 10 * the amount of saliva a PC have.
  • Then, the normal effect will be triggered.
    • If the well is polluted, debuff will be applied to the PC.
    • If the well is clean, it is as if the PC drank real water.


  • Overall Chances for non-holy, non-polluted well:
    • 10% Main Attribute Potential Increase
    • 10% Main Attribute Potential Decrease
    • 16% 1 of 7 type of Bad effect on PC
    • 16% Random Mutation on PC
    • 4.8% Wish (if PC meet the requirement)
    • 43.2% Plain Water.