Elin:Code Analysis/Unclassified: Difference between revisions

From Ylvapedia
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
'''For authors''': Please note the version of game tested on for each section added.
'''For authors''': Please note the version of game tested on for each section added.


==Sword Mage - Talisman Trait (EA23.54)==
== Drink from well (EA23.67)==
{{Version|23.54}}
{{Version|23.67}}
<syntaxhighlight lang="c#" line="1">
<syntaxhighlight lang="c#" line="1">
    case MixType.Talisman:
public override void TrySetAct(ActPlan p)
{
p.TrySetAct("actDrink", delegate
{
{
int num2 = EClass.pc.Evalue(1418);
if (Charges <= 0)
Thing thing4 = ai.ings[1];
{
SourceElement.Row source2 = (thing4.trait as TraitSpellbook).source;
EClass.pc.Say("drinkWell_empty", EClass.pc, owner);
int num3 = thing4.c_charges * source2.charge * (100 + num2 * 50) / 500 + 1;
return false;
int num4 = 100;
}
Thing thing5 = ThingGen.Create("talisman").SetNum(num3);
EClass.pc.Say("drinkWell", EClass.pc, owner);
thing5.refVal = source2.id;
EClass.pc.PlaySound("drink");
thing5.encLV = num4 * (100 + num2 * 10) / 100;
EClass.pc.PlayAnime(AnimeID.Shiver);
thing.ammoData = thing5;
if (IsHoly || EClass.rnd(5) == 0)
thing.c_ammo = num3;
{
EClass.pc.Say("talisman", thing, thing5);
ActEffect.Proc(EffectId.ModPotential, EClass.pc, null, (!polluted && (IsHoly || EClass.rnd(2) == 0)) ? 100 : (-100));
thing4.Destroy();
}
break;
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);
}
</syntaxhighlight>
</syntaxhighlight>


* The "talisman mastery 2" trait of swordmage positively influence the effect of created talismans. Specifically:
* These code explains what happens when you drink water from well.
** The number of charges created by swordmage will be '''(magic_book_charges * num_of_charge_gained_if_read * 2 / 5) + 1'''.
* These effects will be applied step by step.
** For a normal PC, the number of charges will be '''(magic_book_charges * num_of_charge_gained_if_read * 1 / 5) + 1'''.
* In 1/5 chance, potential of a main attribute will increase (50%) or decrease (50%).
*** For example, for a magic book with 3 reads left with each read giving PC 10 charges, the number of talisman charge by swordmage would be 13, while by normal PC would be 7.
** This will be forced to trigger if it i a holy well, and will be 100% increase.
** The talisman level created by swordmage is fixed at 120, while fixed at 100 by normal PC.
* 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.


[[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 up to date for the latest stable release of Elin.
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.