User talk:VeryGoodDog

From Vintage Story Wiki
Jump to: navigation, search

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;
	}}