Skip to content

cogpunk/mathhammer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cogpunk Mathhammer

Cogpunk Mathhammer is a framework for determining the probabilities and statistics of the game of Warhammer 40,000 (8th & 9th Editions)

Build Status Quality Gate Status Coverage Maintainability Rating Reliability Rating Security Rating Apache License, Version 2.0 Cogpunk Mathhammer

Building from source

The build requires a Java 11 JDK (or higher) and uses Maven

mvn install

Adding as a dependency

<dependency>
	<groupId>com.cogpunk</groupId>
	<artifactId>cogpunk-mathhammer</artifactId>
	<version>1.0.4</version>
</dependency>

License

Code is under the Apache Licence v2.

Example

Statistics statistics = new Statistics(
			new AverageRollCalculator(
					new FractionOperator()), 
			new AttackDamageProfileCalculator());

CombatantProfile intercessor = new CombatantProfileImpl(
	new FixedValue(1), // Number of attacks probability Profile
	3,                 // To Hit Target
	0,                 // To Hit Modifier
	ReRoll.NONE,       // To Hit Re-roll
	4,                 // Strength
	4,                 // Toughness
	0,                 // To Wound Modifier
	ReRoll.NONE,       // To Wound Re roll
	3,                 // Save Target
	null,              // Invulnerable Save target
	-1,                // Armour Penetration Modifier
	ReRoll.NONE,       // Save Re roll
	new FixedValue(1), // Damage probability Profile
	2,                 // Wounds
	18                 // Points Cost
);

CombatantProfile necronWarrior =  new CombatantProfileImpl(
	new FixedValue(1), // Number of attacks probability Profile
	3,                 // To Hit Target
	0,                 // To Hit Modifier
	ReRoll.NONE,       // To Hit Re-roll
	4,                 // Strength
	4,                 // Toughness
	0,                 // To Wound Modifier
	ReRoll.NONE,       // To Wound Re roll
	4,                 // Save Target
	null,              // Invulnerable Save target
	-1,                // Armour Penetration Modifier
	ReRoll.NONE,       // Save Re roll
	new FixedValue(1), // Damage probability Profile
	1,                 // Wounds
	12                 // Points Cost
);

// Determine the kill ratio of the Intercessor vs the Necron Warrior

System.out.println(statistics.killRatio(intercessor, necronWarrior));

Which returns the result of 8/3, meaning that 3 Intercessors will be killed for every 8 Necron Warriors

Disclaimer

This code is completely unofficial and in no way endorsed by Games Workshop Limited.

Necrons, Intercessors and the Warhammer 40,000 rules are either ®, ™ and/or © Games Workshop Ltd, variably registered in the UK and other countries around the world. Used without permission. No challenge to their status intended. All Rights Reserved to their respective owners.

No challenge whatsoever is intended to the status of any intellectual property rights of Games Workshop Limited, including, but not limited to trademarks and copyrights of Games Workshop Limited. This has no legal connection or relationship to Games Workshop Limited.

About

A framework for determining the probabilities and statistics of the game of Warhammer 40,000 (8th & 9th Editions)

Resources

License

Stars

Watchers

Forks

Packages

No packages published