User talk:VeryGoodDog: Difference between revisions

From Vintage Story Wiki
(Created page with "hahahahahahha <nowiki> using System; public class MainClass {public void Main(){ Console.WriteLine(handleDamaged(1.0F, 0.6F, 2, new float[]{0.1F, 0.5F}, new float[]{0.1F, 0....")
 
No edit summary
 
Line 1: Line 1:
hahahahahahha
hahahahahahha
<nowiki>
https://dotnetfiddle.net/
<pre><nowiki>
using System;
using System;
public class MainClass
public class MainClass
Line 23: Line 24:
}}
}}
</nowiki>
</nowiki>
</pre>

Latest revision as of 21:27, 26 November 2019

hahahahahahha https://dotnetfiddle.net/

using System;
public class MainClass
{public void Main(){
		Console.WriteLine(handleDamaged(1.0F, 0.6F, 2, new float[]{0.1F, 0.5F}, new float[]{0.1F, 0.2F}, 9.0F, 2));}
	public float handleDamaged(float flatDmgProt, float percentProt, int protTier, float[] tierFlatProt, float[] tierRelProt, float damage, int weaponTier) {
		bool aboveTier = weaponTier > protTier;
		Console.WriteLine(aboveTier);
		Console.WriteLine("Prots:  " + flatDmgProt + " " + percentProt);
		for (int i = 0; i < weaponTier; i++) {
			float flatLoss = aboveTier ? tierFlatProt[1] : tierFlatProt[0];
			float percLoss = aboveTier ? tierRelProt[1] : tierRelProt[0];
			Console.WriteLine("Losses: "+flatLoss + " " + percLoss);
			flatDmgProt -= flatLoss;
			percentProt -= percLoss;
			Console.WriteLine("Prots:  " + flatDmgProt + " " + percentProt);
		}
		damage -= Math.Max(0, flatDmgProt);
		Console.WriteLine(damage);
		damage *= 1 - Math.Max(0, percentProt);
		return damage;
	}}