Added a bunch of moves
This commit is contained in:
parent
bebbf469db
commit
273a79c9c6
1
FakeMon/.gitignore
vendored
Normal file
1
FakeMon/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/bin/
|
@ -14,12 +14,11 @@ case class Prop(url : Seq[String])
|
|||||||
|
|
||||||
object Game {
|
object Game {
|
||||||
def main(args : Array[String]): Unit = {
|
def main(args : Array[String]): Unit = {
|
||||||
|
|
||||||
implicit val rng = new scala.util.Random()
|
implicit val rng = new scala.util.Random()
|
||||||
val form1 = Form("Diabolo")
|
val form1 = Form("Diabolo")
|
||||||
val form2 = Form("Chanilla")
|
val form2 = Form("Chanilla")
|
||||||
val movepool1 = IndexedSeq(Move("electroball"), Move("thunderwave"))
|
val movepool1 = IndexedSeq(Move("eruption"))
|
||||||
val movepool2 = IndexedSeq(Move("headbutt"))
|
val movepool2 = IndexedSeq(Move("flail"))
|
||||||
val p1 = TrainerID("Jaeda", Gender.Female, 0)
|
val p1 = TrainerID("Jaeda", Gender.Female, 0)
|
||||||
val p2 = TrainerID("Wild Monster", Gender.Male, 0)
|
val p2 = TrainerID("Wild Monster", Gender.Male, 0)
|
||||||
val party1 = new Party(p1, new MonsterPtr(Monster.generate("Allied Mon", p1, 500, form1, movepool1)), IndexedSeq())
|
val party1 = new Party(p1, new MonsterPtr(Monster.generate("Allied Mon", p1, 500, form1, movepool1)), IndexedSeq())
|
||||||
|
@ -17,7 +17,7 @@ object MoveType extends Enumeration {
|
|||||||
class MoveTypeType extends TypeReference[MoveType.type]
|
class MoveTypeType extends TypeReference[MoveType.type]
|
||||||
|
|
||||||
object Target extends Enumeration {
|
object Target extends Enumeration {
|
||||||
val Normal, Self, AllAdjacentFoes = Value
|
val Normal, Self, Any, AllAdjacent, AllAdjacentFoes = Value
|
||||||
}
|
}
|
||||||
class TargetType extends TypeReference[Target.type]
|
class TargetType extends TypeReference[Target.type]
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ abstract class Move extends MoveTurn {
|
|||||||
val desc: String
|
val desc: String
|
||||||
val category: MoveType
|
val category: MoveType
|
||||||
val pow: Int
|
val pow: Int
|
||||||
val powCallback: (Monster, Monster) => Int
|
val powCallback: (Monster, Move, Monster) => Int
|
||||||
val prior: Int
|
val prior: Int
|
||||||
val accuracy: Int
|
val accuracy: Int
|
||||||
val pp: Int
|
val pp: Int
|
||||||
@ -135,7 +135,7 @@ abstract class Move extends MoveTurn {
|
|||||||
val atkStat = if (category == MoveType.Physical) PAtk else MAtk
|
val atkStat = if (category == MoveType.Physical) PAtk else MAtk
|
||||||
val defStat = if (category == MoveType.Physical) PDef else MDef
|
val defStat = if (category == MoveType.Physical) PDef else MDef
|
||||||
// TODO : Fixed damage
|
// TODO : Fixed damage
|
||||||
val actualPow = if (powCallback != null) powCallback(user, target) else pow
|
val actualPow = if (powCallback != null) powCallback(user, this, target) else pow
|
||||||
val baseDmg = (2 * user.level / 5 + 2) * actualPow * user(atkStat) / (target(defStat) * 50) + 2
|
val baseDmg = (2 * user.level / 5 + 2) * actualPow * user(atkStat) / (target(defStat) * 50) + 2
|
||||||
val effectiveness = target.effectiveness(element)
|
val effectiveness = target.effectiveness(element)
|
||||||
val multiplier = effectiveness * critMultiplier(user, target)
|
val multiplier = effectiveness * critMultiplier(user, target)
|
||||||
@ -246,14 +246,14 @@ object Move {
|
|||||||
moves(name)
|
moves(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
def compilePowCallback(code: String): (Monster, Monster) => Int = {
|
def compilePowCallback(code: String): (Monster, Move, Monster) => Int = {
|
||||||
if (code != null) {
|
if (code != null) {
|
||||||
val tb = runtimeMirror(getClass.getClassLoader).mkToolBox()
|
val tb = runtimeMirror(getClass.getClassLoader).mkToolBox()
|
||||||
val tree = tb.parse(
|
val tree = tb.parse(
|
||||||
s"""
|
s"""
|
||||||
|import fmon.stat.Monster
|
|import fmon.stat._
|
||||||
|import fmon.stat.Statistic._
|
|import fmon.stat.Statistic._
|
||||||
|def callback(user : Monster, target : Monster): Int = {
|
|def callback(user : Monster, move: Move, target : Monster): Int = {
|
||||||
| $code
|
| $code
|
||||||
|}
|
|}
|
||||||
|callback _
|
|callback _
|
||||||
@ -261,7 +261,7 @@ object Move {
|
|||||||
val f = tb.compile(tree)
|
val f = tb.compile(tree)
|
||||||
val wrapper = f()
|
val wrapper = f()
|
||||||
|
|
||||||
wrapper.asInstanceOf[(Monster, Monster) => Int]
|
wrapper.asInstanceOf[(Monster, Move, Monster) => Int]
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user