<commit_before>import * as etg from '../etg.js';
import Skills from '../Skills.js';
import parseSkill from '../parseSkill.js';

function pillarval(c) {
	return c.type === etg.Spell ? 0.1 : Math.sqrt(c.getStatus('charges'));
}
const SkillsValues = {
	acceleration: 5,
	accretion: 8,
	adrenaline: 8,
	aflatoxin: 5,
	aggroskele: 2,
	alphawolf: c => (c.type === etg.Spell ? 3 : 0),
	animateweapon: 4,
	antimatter: 12,
	appease: c =>
		c.type === etg.Spell
			? -6
			: c.getStatus('appeased')
			? 0
			: c.trueatk() * -1.5,
	bblood: 7,
	beguilestop: c => -getDamage(c.game, c),
	bellweb: 1,
	blackhole: c => {
		let a = 0,
			fq = c.owner.foe.quanta;
		for (let i = 1; i < 13; i++) {
			a += Math.min(fq[i], 3) / 3;
		}
		return a;
	},
	bless: 4,
	boneyard: 3,
	bounce: c => c.card.cost + (c.card.upped ? 1 : 0),
	bravery: c =>
		Math.min(
			4,
			8 - Math.max(c.owner.handIds.length - 1, c.owner.foe.handIds.length),
		),
	brawl: 8,
	brew: 4,
	brokenmirror: c =>
		c.owner.foe.shieldId && c.owner.foe.shield.getStatus('reflective') ? -3 : 2,
	bubbleclear: 3,
	burrow: 1,
	butterfly: 12,
	catapult: 6,
	chimera: 4,
	chromastat: c =>
		1 +
		(c.type === etg.Spell
			? c.card.health + c.card.attack
			: c.trueatk() + c.truehp()) /
			3,
	clear: 2,
	corpseexplosion: 1,
	counter: 3,
	countimmbur: 1,
	cpower: 4,
	cseed: 4,
	cseed2: 4,
	creatureupkeep: c =>
		c.owner.foe.countcreatures() - c.owner.countcreatures() / 2,
	darkness: 1,
	deadalive: 2,
	deathwish: 1,
	deckblast: c => c.owner.deck.length / 2,
	deepdive: (c, ttatk) => (c.type === etg.Spell ? c.card.attack : ttatk / 1.5),
	deepdiveproc: (c, ttatk) => (c.type === etg.Spell ? c.card.attack : ttatk),
	deja: 4,
	deployblobs: c =>
		2 +
		(c.type === etg.Spell
			? Math.min(c.card.attack, c.card.health)
			: Math.min(c.trueatk(), c.truehp())) /
			4,
	destroy: 8,
	destroycard: 1,
	devour: c => 2 + (c.type === etg.Spell ? c.card.health : c.truehp()),
	disarm: c =>
		!c.owner.foe.weapon
			? 0.1
			: c.owner.foe.handIds.length === 8
			? 0.5
			: c.owner.foe.weapon.card.cost,
	disfield: c => {
		let q = 3;
		const perms = c.owner.permanentIds;
		for (let i = 0; i < 16; i++) {
			if (perms[i]) {
				const perm = c.owner.game.byId(perms[i]);
				if (perm.card.type === etg.Pillar) {
					q +=
						(perm.card.element === etg.Chroma ? 3 : 1) *
						perm.getStatus('charges');
				}
			}
		}

		return q;
	},
	disshield: c => {
		let q = 2;
		const perms = c.owner.permanentIds;
		for (let i = 0; i < 16; i++) {
			if (perms[i]) {
				const perm = c.owner.game.byId(perms[i]);
				if (perm.card.code === etg.PillarList[etg.Entropy]) {
					q += 3 * perm.getStatus('charges');
				} else if (perm.card.code === etg.PendList[etg.Entropy]) {
					q +=
						(c.owner.mark === etg.Entropy ? 3 : 1.5) *
						perm.getStatus('charges');
				}
			}
		}

		return q * 0.8;
	},
	dive: (c, ttatk) =>
		c.type === etg.Spell ? c.card.attack : ttatk - c.getStatus('dive') / 1.5,
	divinity: 3,
	drainlife: 10,
	draft: 1,
	drawcopy: 1,
	drawequip: 2,
	drawpillar: 1,
	dryspell: 5,
	dshield: 4,
	duality: 4,
	earthquake: 4,
	eatspell: 3,
	embezzle: 7,
	empathy: c => c.owner.countcreatures(),
	enchant: 6,
	endow: 4,
	envenom: 3,
	epidemic: 4,
	epoch: 2,
	evolve: 2,
	feed: 6,
	fickle: 3,
	firebolt: 10,
	flatline: 1,
	flyingweapon: 7,
	foedraw: 8,
	forcedraw: -10,
	forceplay: 2,
	fractal: c => 3 + (9 - c.owner.handIds.length) / 4,
	freedom: 5,
	freeze: [3, 3.5],
	freezeperm: [3.5, 4],
	fungusrebirth: 1,
	gas: 5,
	give: 1,
	golemhit: c => {
		let dmg = 0;
		c.owner.creatures.forEach(cr => {
			if (
				cr &&
				cr.getStatus('golem') &&
				!cr.getStatus('delayed') &&
				!cr.getStatus('frozen')
			) {
				const atk = getDamage(cr.game, cr);
				if (atk > dmg) dmg = atk;
			}
		});
		return dmg;
	},
	gpull: c => (c.type === etg.Spell || c.id !== c.owner.gpull ? 2 : 0),
	gpullspell: 3,
	gratitude: 4,
	grave: 1,
	'growth 1': 2,
	'growth 2': 5,
	'growth 3': 7,
	'growth 1 0': 1,
	'growth 2 0': 3,
	'growth 2 -1': c => 2 + c.truehp(),
	'growth 3 -1': c => 4 + c.truehp(),
	guard: 4,
	halveatk: c => {
		let atk;
		return c.type === etg.Spell
			? -c.card.attack / 4
			: ((atk = c.trueatk()) < 0) - (atk > 0);
	},
	hasten: c => Math.min(c.owner.deck.length / 4, 10),
	hatch: 3,
	heal: 8,
	heatmirror: 2,
	hitownertwice: c => (c.type === etg.Spell ? c.card.attack : c.trueatk()) * -2,
	holylight: 3,
	hope: 2,
	icebolt: 10,
	ignite: 4,
	immolate: 5,
	improve: 6,
	inertia: 2,
	infect: 4,
	ink: 3,
	innovation: 3,
	integrity: 4,
	jelly: 5,
	jetstream: 2.5,
	lightning: 7,
	liquid: 5,
	livingweapon: 2,
	lobotomize: 6,
	loot: 2,<commit_msg>Teach AI to value guard's damage potential<commit_after>import * as etg from '../etg.js';
import Skills from '../Skills.js';
import parseSkill from '../parseSkill.js';

function pillarval(c) {
	return c.type === etg.Spell ? 0.1 : Math.sqrt(c.getStatus('charges'));
}
const SkillsValues = {
	acceleration: 5,
	accretion: 8,
	adrenaline: 8,
	aflatoxin: 5,
	aggroskele: 2,
	alphawolf: c => (c.type === etg.Spell ? 3 : 0),
	animateweapon: 4,
	antimatter: 12,
	appease: c =>
		c.type === etg.Spell
			? -6
			: c.getStatus('appeased')
			? 0
			: c.trueatk() * -1.5,
	bblood: 7,
	beguilestop: c => -getDamage(c.game, c),
	bellweb: 1,
	blackhole: c => {
		let a = 0,
			fq = c.owner.foe.quanta;
		for (let i = 1; i < 13; i++) {
			a += Math.min(fq[i], 3) / 3;
		}
		return a;
	},
	bless: 4,
	boneyard: 3,
	bounce: c => c.card.cost + (c.card.upped ? 1 : 0),
	bravery: c =>
		Math.min(
			4,
			8 - Math.max(c.owner.handIds.length - 1, c.owner.foe.handIds.length),
		),
	brawl: 8,
	brew: 4,
	brokenmirror: c =>
		c.owner.foe.shieldId && c.owner.foe.shield.getStatus('reflective') ? -3 : 2,
	bubbleclear: 3,
	burrow: 1,
	butterfly: 12,
	catapult: 6,
	chimera: 4,
	chromastat: c =>
		1 +
		(c.type === etg.Spell
			? c.card.health + c.card.attack
			: c.trueatk() + c.truehp()) /
			3,
	clear: 2,
	corpseexplosion: 1,
	counter: 3,
	countimmbur: 1,
	cpower: 4,
	cseed: 4,
	cseed2: 4,
	creatureupkeep: c =>
		c.owner.foe.countcreatures() - c.owner.countcreatures() / 2,
	darkness: 1,
	deadalive: 2,
	deathwish: 1,
	deckblast: c => c.owner.deck.length / 2,
	deepdive: (c, ttatk) => (c.type === etg.Spell ? c.card.attack : ttatk / 1.5),
	deepdiveproc: (c, ttatk) => (c.type === etg.Spell ? c.card.attack : ttatk),
	deja: 4,
	deployblobs: c =>
		2 +
		(c.type === etg.Spell
			? Math.min(c.card.attack, c.card.health)
			: Math.min(c.trueatk(), c.truehp())) /
			4,
	destroy: 8,
	destroycard: 1,
	devour: c => 2 + (c.type === etg.Spell ? c.card.health : c.truehp()),
	disarm: c =>
		!c.owner.foe.weapon
			? 0.1
			: c.owner.foe.handIds.length === 8
			? 0.5
			: c.owner.foe.weapon.card.cost,
	disfield: c => {
		let q = 3;
		const perms = c.owner.permanentIds;
		for (let i = 0; i < 16; i++) {
			if (perms[i]) {
				const perm = c.owner.game.byId(perms[i]);
				if (perm.card.type === etg.Pillar) {
					q +=
						(perm.card.element === etg.Chroma ? 3 : 1) *
						perm.getStatus('charges');
				}
			}
		}

		return q;
	},
	disshield: c => {
		let q = 2;
		const perms = c.owner.permanentIds;
		for (let i = 0; i < 16; i++) {
			if (perms[i]) {
				const perm = c.owner.game.byId(perms[i]);
				if (perm.card.code === etg.PillarList[etg.Entropy]) {
					q += 3 * perm.getStatus('charges');
				} else if (perm.card.code === etg.PendList[etg.Entropy]) {
					q +=
						(c.owner.mark === etg.Entropy ? 3 : 1.5) *
						perm.getStatus('charges');
				}
			}
		}

		return q * 0.8;
	},
	dive: (c, ttatk) =>
		c.type === etg.Spell ? c.card.attack : ttatk - c.getStatus('dive') / 1.5,
	divinity: 3,
	drainlife: 10,
	draft: 1,
	drawcopy: 1,
	drawequip: 2,
	drawpillar: 1,
	dryspell: 5,
	dshield: 4,
	duality: 4,
	earthquake: 4,
	eatspell: 3,
	embezzle: 7,
	empathy: c => c.owner.countcreatures(),
	enchant: 6,
	endow: 4,
	envenom: 3,
	epidemic: 4,
	epoch: 2,
	evolve: 2,
	feed: 6,
	fickle: 3,
	firebolt: 10,
	flatline: 1,
	flyingweapon: 7,
	foedraw: 8,
	forcedraw: -10,
	forceplay: 2,
	fractal: c => 3 + (9 - c.owner.handIds.length) / 4,
	freedom: 5,
	freeze: [3, 3.5],
	freezeperm: [3.5, 4],
	fungusrebirth: 1,
	gas: 5,
	give: 1,
	golemhit: c => {
		let dmg = 0;
		c.owner.creatures.forEach(cr => {
			if (
				cr &&
				cr.getStatus('golem') &&
				!cr.getStatus('delayed') &&
				!cr.getStatus('frozen')
			) {
				const atk = getDamage(cr.game, cr);
				if (atk > dmg) dmg = atk;
			}
		});
		return dmg;
	},
	gpull: c => (c.type === etg.Spell || c.id !== c.owner.gpull ? 2 : 0),
	gpullspell: 3,
	gratitude: 4,
	grave: 1,
	'growth 1': 2,
	'growth 2': 5,
	'growth 3': 7,
	'growth 1 0': 1,
	'growth 2 0': 3,
	'growth 2 -1': c => 2 + c.truehp(),
	'growth 3 -1': c => 4 + c.truehp(),
	guard: (c, ttatk) => 4 + ttatk + c.getStatus('airborne'),
	halveatk: c => {
		let atk;
		return c.type === etg.Spell
			? -c.card.attack / 4
			: ((atk = c.trueatk()) < 0) - (atk > 0);
	},
	hasten: c => Math.min(c.owner.deck.length / 4, 10),
	hatch: 3,
	heal: 8,
	heatmirror: 2,
	hitownertwice: c => (c.type === etg.Spell ? c.card.attack : c.trueatk()) * -2,
	holylight: 3,
	hope: 2,
	icebolt: 10,
	ignite: 4,
	immolate: 5,
	improve: 6,
	inertia: 2,
	infect: 4,
	ink: 3,
	innovation: 3,
	integrity: 4,
	jelly: 5,
	jetstream: 2.5,
	lightning: 7,
	liquid: 5,
	livingweapon: 2,
	lobotomize: 6,
	loot: 2,
{'fraction_non_alphanumeric': 0.20138214015765035, 'fraction_numerical': 0.0397365295324479, 'mean_word_length': 2.715202567188127, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 64, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2524114', 'n_tokens_mistral': 5084, 'n_tokens_neox': 4368, 'n_words': 991}