Coder Social home page Coder Social logo

adarro / ddo-calc Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 3.0 36.48 MB

DDO Calculations, Planner and Plotting

License: Apache License 2.0

Scala 75.01% HTML 19.38% Batchfile 0.01% Gherkin 0.01% Java 3.52% Kotlin 0.19% Shell 0.03% Pug 0.28% CSS 1.16% Scaml 0.05% ANTLR 0.37%
ddo planner

ddo-calc's People

Contributors

adarro avatar dependabot[bot] avatar renovate-bot avatar renovate[bot] avatar snyk-bot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

ddo-calc's Issues

Base Value may need to be a double or something to better represent

Base Value may need to be a double or something to better represent

* TODO: Base Value may need to be a double or something to better represent

   * Additional Effects such as enchantments on a Weapon
   */
  val effects: List[Effect] = Nil

  /**
   * //TODO: create set bonus case classes
   */
  val setBonus: List[SetItem] = Nil

  /**
   * Represents monetary in game amount. plat / gold / copper. Low Priority i.e. Base Value: 7pp 5gp
   * TODO: Base Value may need to be a double or something to better represent
   */
  val baseValue: Option[Coins]

  /**
   * Weight of item, in pounds i.e. Weight: 2 lbs
   */
  val weight: Option[Int]

8c916f520401034d4fbc8ad3a80a6698924a0457

Need full pass on Suffix etc as many deep changes since 2017

Need full pass on Suffix etc as many deep changes since 2017

Need to add Protection to Reinforcement

// TODO: Need full pass on Suffix etc as many deep changes since 2017

  case object LightResistance extends ArmorSuffix with DamageReduction with Light
  case object Power extends ArmorSuffix
  case object Prisms extends ArmorSuffix with ElementalResistance
  // TODO: Need full pass on Suffix etc as many deep changes since 2017
  //  Need to add Protection to Reinforcement
  case object Reinforcement extends ArmorSuffix with DamageReduction with FullPhysical
  case object Shadow extends ArmorSuffix
  case object SilentMoves extends ArmorSuffix

581b5ddebd845734a2795d96af34a21a9305bb2b

use the Try[part] instead of the

use the Try[part] instead of the

partToModify

@return

Source text.

* Sets or maps the source text for the DisplayName. // TODO: use the Try[part] instead of the

 * @tparam E
 *   Entry ID / Enumeration used to qualify which part is being modified.
 */
trait PartModifier[V, E <: EnumEntry] extends Feature[V] with DisplayName {
  self: UsingSearchPrefix =>
  /**
   * The current Seaerch-Fu is weak. Override this default function.
   */
  override lazy val part: Try[EffectPart] =
    EffectPart.tryFindByPattern(partToModify.entryName, Option(withPrefix))
  override lazy val parameters: Seq[Try[EffectParameter]] = effectParameters.map(_.parameter)
// FIXME add UsingSearchPrefix to type constraint
  override val withPrefix: String = s"$searchPrefix$nameSource"
  protected[this] val partToModify: E

  protected[this] def effectParameters: Seq[ParameterModifier[_]] = ???

  /**
   * Sets or maps the source text for the DisplayName. // TODO: use the Try[part] instead of the
   * partToModify
   *
   * @return
   *   Source text.
   */
  override protected def nameSource: String = partToModify.entryName
}

trait FeatModifier[T, E <: Feat] extends PartModifier[T, E] {
  self: UsingSearchPrefix =>

}

/**
 * A parameter that SHOULD be found in EffectParameter used for validation / stacking
 * @tparam E
 *   Enum of the parameter type being used, such as A Bonus Type of 'Action Boost'
 */
trait ParameterModifier[E <: EnumEntry] {

  lazy val parameter: Try[EffectParameter] =
    EffectParameter.tryFindByPattern(parameterToModify.entryName, None)
  protected[this] val parameterToModify: E
}

case class EffectFeature[T](
  parameter: Try[EffectParameter],
  override val part: Try[EffectPart],
  override val source: SourceInfo,
  override val categories: Seq[String],
  override val value: T,
  override val generalDescription: String,
  effectDetail: DetailedEffect)
  extends Feature[T] {
  override def parameters: Seq[Try[EffectParameter]] = ???
}

d992fe2617a2fbd18b994ffb4afaf835336adbd2

Implement Magnitude then change this to a case class

Implement Magnitude then change this to a case class

applying [[io.truthencode.ddo.model.effect.Magnitude]]

* Used to amplify a given value. // TODO: Implement Magnitude then change this to a case class

/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2015-2021 Andre White.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.truthencode.ddo.support.numbers

import enumeratum.{Enum, EnumEntry}

sealed trait Numbers extends EnumEntry

/**
 * Flags / case classes used for evaluating and typing numbers for saves / difficulty checks /
 * magnitude etc.
 */
object Numbers extends Enum[Numbers] {
  override def values: IndexedSeq[Numbers] = findValues

  /**
   * Used to amplify a given value. // TODO: Implement Magnitude then change this to a case class
   * applying [[io.truthencode.ddo.model.effect.Magnitude]]
   */
  case object Magnitude extends Numbers

  /**
   * Will be used for flagging / calculating saves / difficult checks.
   */
  case object DifficultyCheck extends Numbers
}

ad98312872530db53031d614fc3e63cf57847a2e

create set bonus case classes

create set bonus case classes

/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2015-2021 Andre White.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.truthencode.ddo.model.item

import io.truthencode.ddo.MonetaryValue.Coins
import io.truthencode.ddo.model.effect.Effect
import io.truthencode.ddo.model.misc.Material
import io.truthencode.ddo.model.race.Race
import io.truthencode.ddo.{BindingFlags, MetaData, SetItem}

/**
 * A general Item, which can be a Weapon, Armor, potion, scroll etc.
 */
trait Item extends MetaData {
  /**
   * A Friendly, Kobold readable description or explanation of the item.
   */
  val description: Option[String]

  /**
   * requiredRaces - list of races the player or pet MUST be to naturally equip the item unless they
   * can bypass with a high enough UMD.
   */
  val requiredRaces: List[Race] = Nil
  /**
   * A list of races that a player MUST be to equip the item.
   */
  val absoluteRequiredRaces: List[Race] = Nil

  /**
   * A list of races the player MUST NOT be in order to wear.
   * @example
   *   Warforged can NOT wear plate armor.
   */
  val absoluteRestrictedRaces: List[Race] = Nil

  /**
   * Represents the Minimum level a player must be to equip this item.
   */
  val minimumLevel: Int

  /**
   * Represents the absolute minimum level of the item. This is usually due to augments or crafting
   * or other alterations to a base item.
   */
  val absoluteMinimumLevel: Option[Int]

  /**
   * Use Magical Device [[http://ddowiki.com/page/Use_Magic_Device UMD]] Skill level needed to
   * bypass certain restrictions such as using wands below level or out of class or bypassing race
   * restrictions.
   */
  val umd: Int

  /**
   * Additional Effects such as enchantments on a Weapon
   */
  val effects: List[Effect] = Nil
  /**
   * //TODO: create set bonus case classes
   */
  val setBonus: List[SetItem] = Nil

  /**
   * Represents monetary in game amount. plat / gold / copper. Low Priority
   * i.e. Base Value: 7pp 5gp TODO: Base Value may need to be a double or something to better
   * represent
   */
  val baseValue: Option[Coins]
  /**
   * Weight of item, in pounds
   * i.e. Weight: 2 lbs
   */
  val weight: Option[Int]

  /**
   * Durability
   *
   * The durability is the toughness of the item. The higher the durability, the more damage it can
   * withstand before breaking. The material also contributes to this value.
   *
   * @note
   *   For purposes of this API, only maximum durability is considered. Not instance.
   * i.e. Durability 120 means 120 / 120, your actual item may have wear.
   */
  val durability: Int

  /**
   * Material what the item is "made from"
   * I.e. bows - typically wood, plate mail may be steel or dwarven iron.
   *
   * @example
   *   Druids (and their pets) can wear leather armour. Generally they wear light armour or cloth,
   *   however, there are a few medium armours made from chiten or carapace that would not violate
   *   the druidic oath.
   */
  val material: Option[Material]

  /**
   * Hardness Generally based on the material and influences how quickly durability is decreased.
   * Adamantum and Diamond would have a higher rating that wood.
   */
  val hardness: Int

  /**
   * Indicates the binding status, if any for the item.
   */
  val binding: Option[BindingFlags]

  /**
   * List of enchantments
   */
  val enchantments: Option[Seq[String]]

}

cdd39fcf4293ceb4bc06a81ef0c430ce51a9608a

Revisit EpicPastLife trait post U51 to determine needed qualifiers, if any.

Revisit EpicPastLife trait post U51 to determine needed qualifiers, if any.

May just need Any PL now.

val pastEpicClass : EpicCharacterClass

// TODO: Revisit EpicPastLife trait post U51 to determine needed qualifiers, if any.

}

trait EpicPastLife extends PastLife {
  // TODO: Revisit EpicPastLife trait post U51 to determine needed qualifiers, if any.
  // May just need Any PL now.
  // val pastEpicClass : EpicCharacterClass
}

a09dc1fa74be5be4f3a23762f770eb913eee6b0e

Move prefixes to naming package and out of enhancement as they might be used gen...

Move prefixes to naming package and out of enhancement as they might be used generically

for feats / enhancements etc.

* TODO: Move prefixes to naming package and out of enhancement as they might be used generically

package io.truthencode.ddo.support.naming

/**
 * TODO: Move prefixes to naming package and out of enhancement as they might be used generically
 * for feats / enhancements etc.
 */
trait SpellCriticalChancePrefix extends SpellCriticalPrefix {
  self: DisplayName =>

3fbdaf1ae8027566f2c166994694a9c058b01678

Base Value may need to be a double or something to better

Base Value may need to be a double or something to better

represent

* i.e. Base Value: 7pp 5gp TODO: Base Value may need to be a double or something to better

  /**
   * Represents monetary in game amount. plat / gold / copper. Low Priority
   * i.e. Base Value: 7pp 5gp TODO: Base Value may need to be a double or something to better
   * represent
   */
  val baseValue: Option[Coins]
  /**

ee0827ba86549a21b4827099239ab6f3e2ee8f0a

Add org check for scala-lang

Add org check for scala-lang

Scala 2x lib may be on path regardless of S3 / S2 due to legacy / BOM enforcedPlatform import etc. ::frown:: (I'm looking at you Quarkus!)

// TODO: Add org check for scala-lang


 * We should also incorporate the -new-syntax option here instead of below
 */
val rewriteOption = project.findProperty("s3rewrite")?.toString() ?: ""

enum class MigrationDirection {
    FromScala3,
    ToScala3,
    None
}

enum class MigrationPhase {
    Initial,
    Second,
    None
}

fun migrationOptions(): Migration {
    return when (rewriteOption) {
        "toScala3First" -> Migration(MigrationDirection.ToScala3, MigrationPhase.Initial)
        "toScala3Second" -> Migration(MigrationDirection.ToScala3, MigrationPhase.Second)
        "fromScala3First" -> Migration(MigrationDirection.FromScala3, MigrationPhase.Initial)
        "fromScala3Second" -> Migration(MigrationDirection.FromScala3, MigrationPhase.Second)
        else -> Migration(MigrationDirection.None, MigrationPhase.None)
    }

}

data class Migration(val direction: MigrationDirection, val phase: MigrationPhase) {

    // -rewrite or null
    private val action: String? = if (direction != MigrationDirection.None) "-rewrite" else null

    // Braces vs Significant Indentation
    private val syntax = Pair("-noindent", "-indent")

    // Control new vs old control structure
    private val structure = Pair("-old-syntax", "-new-syntax")

    val opt: Sequence<String> = when (direction) {
        MigrationDirection.ToScala3 -> {

            when (phase) {
                MigrationPhase.Initial -> {
                    sequenceOf(action.orEmpty(), structure.second)
                }
                MigrationPhase.Second -> {
                    sequenceOf(action.orEmpty(), syntax.second)
                }
                else -> {
                    emptySequence()
                }
            }
        }
        MigrationDirection.FromScala3 -> {
            when (phase) {
                MigrationPhase.Initial -> {
                    sequenceOf(action.orEmpty(), syntax.first)
                }
                MigrationPhase.Second -> {
                    sequenceOf(action.orEmpty(), structure.first)
                }
                else -> {
                    emptySequence()
                }
            }
        }
        MigrationDirection.None -> emptySequence()
    }

}

fun tryFindScalaVersionDependencies(proj: Project, timing: String): List<Dependency> {
    logger.warn("${proj.name.toUpperCase()} $timing +++++++++++++(FROM CONVENTION)++++++++++++++++++++++++++}")
    val cfg = proj.configurations["implementation"].dependencies

    // TODO: Add org check for scala-lang
    val sz = cfg.size
    if (sz > 0) {
        val ncRegx = """scala[\d]?-library.*""".toRegex()
        val sl = cfg.filter { it.name.matches(ncRegx) }
        if (sl.isEmpty()) {
            logger.warn("\t$sz not found")
            cfg.forEach { d -> logger.warn("\t$d.name}") }

        } else {
            logger.warn("found matches")
            sl.forEach { d -> logger.warn("\t${d.name}") }
            cfg.forEach { d ->
                logger.warn(d.name)
            }
            return sl
        }
    }
    return emptyList()

}

fun tryReadScalaVersion(proj: Project, timing: String): Int {
    val dep = tryFindScalaVersionDependencies(proj, timing)
    val s3 = dep.filter { it.name.startsWith("scala3") }
    return if (s3.isEmpty()) 2 else 3
}

/**
 * Make options
 * Conditionally adds compiler options based on if you're migrating between versions, using Scala 2 or Scala 3
 * @note Dependencies may or not yet be resolved / available depending on when (doLast / afterEvaluate) or buildSrc vs Root vs sub-project
 * @param proj current project being compiled.
 * @param timing testing only parameter to display when running.
 *
 * @return values from [scala2CompilerOptions], [scala3CompilerOptions] or [rewrite options](https://docs.scala-lang.org/scala3/guides/migration/tooling-migration-mode.html) (if specified)
 * returns an empty list when no scala-library is found on path.
 */
fun makeOptions(proj: Project, timing: String): Sequence<String> {
    val sv = tryReadScalaVersion(proj, timing)
    val mo = migrationOptions()
    logger.debug("Detected ScalaVersion $sv using options $mo")
    // Current 'safe' option is not to attempt a migration from 2 to 3 if using scala3
    // Scala 2x lib may be on path regardless of S3 / S2 due to legacy / BOM enforcedPlatform import etc. ::frown:: (I'm looking at you Quarkus!)
    val compilerOpt = when (sv) {
        3 -> {
            when (mo.direction) {
                MigrationDirection.ToScala3, MigrationDirection.None -> {
                    if (mo.direction == MigrationDirection.ToScala3)
                        logger.warn("Migrating code to Scala3 skipped re-write options as it appears Scala3 is already on your classpath")
                    scala3CompilerOptions
                }
                MigrationDirection.FromScala3 -> {
                    // just add re-write options
                    mo.opt
                }
            }
        }
        2 -> {
            // Scala 2 options
            when (mo.direction) {
                MigrationDirection.None -> {
                    // Just add S2
                    scala2CompilerOptions
                }
                MigrationDirection.FromScala3, MigrationDirection.ToScala3 -> {
                    // we're migrating, so just use mo
                    mo.opt
                }
            }
        }
        else -> {
            logger.warn("Could not determine scala library on path")
            emptySequence()
        }
    }
    return compilerOpt
}



tasks.withType<ScalaCompile>().configureEach {

    doLast {

        val co = makeOptions(project, "last")
        val msg = co.joinToString { it }
        logger.info("derived compiler options\n $msg")
    }

    tryFindScalaVersionDependencies(project, "inConfigure")
    this.project // scala-library
    scalaCompileOptions.apply {
        val scalaCompilerPlugin by configurations.getting

        val jDocCompilerPlugin =
            listOf("-P:genjavadoc:out=$buildDir/generated/java", "-Xplugin:${scalaCompilerPlugin.asPath}")
        val scalaCoptions = listOf(
            "-feature", "-deprecation", "-Ywarn-dead-code",
            "-Xsource:3"
        )

        additionalParameters?.plusAssign(
            scalaCoptions
        )
        val mo = migrationOptions()

        logger.warn(" Migration options ${mo.opt}")
        logger.debug("executing scala compile with options\n $scalaCoptions")
        // Need to add -Ypartial-unification for Tapir
    }

cf4fdd8215d400d1bb3daf26321c6477767104f6

create set bonus case classes

create set bonus case classes

/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2015-2021 Andre White.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.truthencode.ddo.model.item

import io.truthencode.ddo.MonetaryValue.Coins
import io.truthencode.ddo.model.effect.Effect
import io.truthencode.ddo.model.misc.Material
import io.truthencode.ddo.model.race.Race
import io.truthencode.ddo.{BindingFlags, MetaData, SetItem}

/**
 * A general Item, which can be a Weapon, Armor, potion, scroll etc.
 */
trait Item extends MetaData {
  /**
   * A Friendly, Kobold readable description or explanation of the item.
   */
  val description: Option[String]

  /**
   * requiredRaces - list of races the player or pet MUST be to naturally equip the item unless they
   * can bypass with a high enough UMD.
   */
  val requiredRaces: List[Race] = Nil
  /**
   * A list of races that a player MUST be to equip the item.
   */
  val absoluteRequiredRaces: List[Race] = Nil

  /**
   * A list of races the player MUST NOT be in order to wear.
   * @example
   *   Warforged can NOT wear plate armor.
   */
  val absoluteRestrictedRaces: List[Race] = Nil

  /**
   * Represents the Minimum level a player must be to equip this item.
   */
  val minimumLevel: Int

  /**
   * Represents the absolute minimum level of the item. This is usually due to augments or crafting
   * or other alterations to a base item.
   */
  val absoluteMinimumLevel: Option[Int]

  /**
   * Use Magical Device [[http://ddowiki.com/page/Use_Magic_Device UMD]] Skill level needed to
   * bypass certain restrictions such as using wands below level or out of class or bypassing race
   * restrictions.
   */
  val umd: Int

  /**
   * Additional Effects such as enchantments on a Weapon
   */
  val effects: List[Effect] = Nil
  /**
   * //TODO: create set bonus case classes
   */
  val setBonus: List[SetItem] = Nil

  /**
   * Represents monetary in game amount. plat / gold / copper. Low Priority
   * i.e. Base Value: 7pp 5gp TODO: Base Value may need to be a double or something to better
   * represent
   */
  val baseValue: Option[Coins]
  /**
   * Weight of item, in pounds
   * i.e. Weight: 2 lbs
   */
  val weight: Option[Int]

  /**
   * Durability
   *
   * The durability is the toughness of the item. The higher the durability, the more damage it can
   * withstand before breaking. The material also contributes to this value.
   *
   * @note
   *   For purposes of this API, only maximum durability is considered. Not instance.
   * i.e. Durability 120 means 120 / 120, your actual item may have wear.
   */
  val durability: Int

  /**
   * Material what the item is "made from"
   * I.e. bows - typically wood, plate mail may be steel or dwarven iron.
   *
   * @example
   *   Druids (and their pets) can wear leather armour. Generally they wear light armour or cloth,
   *   however, there are a few medium armours made from chiten or carapace that would not violate
   *   the druidic oath.
   */
  val material: Option[Material]

  /**
   * Hardness Generally based on the material and influences how quickly durability is decreased.
   * Adamantum and Diamond would have a higher rating that wood.
   */
  val hardness: Int

  /**
   * Indicates the binding status, if any for the item.
   */
  val binding: Option[BindingFlags]

  /**
   * List of enchantments
   */
  val enchantments: Option[Seq[String]]

}

cdd39fcf4293ceb4bc06a81ef0c430ce51a9608a

Pull this constraints out of scala and into common

Pull this constraints out of scala and into common

val acceptanceTestImplementation by configurations.getting

acceptanceTestImplementation.extendsFrom(configurations["testCompileClasspath"])

// TODO: Pull this constraints out of scala and into common


    constraints {
        // Must use single string notation, group / name / version will give an error and apply as a dependency
        // api(group = "org.scala-lang", name = "scala-library", version = scalaLibraryVersion)
        api(libs.scala2.library)
        api(libs.logback.classic)
        api(libs.typesafe.scala.logging.s213)

        api(libs.scalafmt.core.s213)
        // Test Dependencies

// Monix https://monix.io
        api(libs.monix.eval.s213)
        api(libs.monix.reactive.s213)

// Quill https://getquill.io
        api(libs.quill.core.s213)
        api(libs.quill.sql.s213)
        api(libs.quill.monix.s213)

        // These dependencies, in implementation, should extend some api denoting test implementation, so perhaps create an apiTest / apiAcceptanceTest config?

        // Unit Testing
        api(libs.scalatest.s213)
        api("org.scalacheck:scalacheck_$scalaMajorVersion:$scalaCheckVersion")
        api(libs.scalatest.plus.mockito.s213)
        api(libs.mockito.core)
        api(libs.wix.accord.core.s213)
        api(libs.wix.accord.scalatest.s213)

        // TODO: Pull this constraints out of scala and into common
        api(libs.org.jetbrains.annotations)
        // JUnit
        api(libs.junit.jupiter)

        // A library providing a DSL for loading and extracting content from HTML pages.
        api(libs.ruippeixotog.scala.scraper.s213)
        api(libs.enumeratum.s213)
        api(libs.typesafe.config)
        api(libs.kxbmap.configs.s213)

        // json libs
        api(libs.json4s.native.s213)

        // JUnit5
        runtime(libs.scalatest.junit.runner)
        runtime(libs.junit.vintage.engine)
        runtime(libs.junit.platform.engine)
        runtime(libs.junit.platform.launcher)
        api(libs.junit.platform.runner)

        // Acceptance Testing
        // val acceptanceTestImplementation by configurations.getting
        // acceptanceTestImplementation.extendsFrom(configurations["testCompileClasspath"])
        api(libs.concordion)
        api(libs.concordion.collapse.output.extension)
        api(libs.concordion.embed.extension)
    }
}

d5ffe17b088bdd829b783cca7ecf3e141b3fba26

Either Consolidate kotlin / java toolchain or make sure there are no conflicts i...

Either Consolidate kotlin / java toolchain or make sure there are no conflicts if they are set different within the same project.

// TODO: Either Consolidate kotlin / java toolchain or make sure there are no conflicts if they are set different within the same project.


    implementation("com.sksamuel.hoplite:hoplite-yaml:$hopliteVersion")
}

// TODO: Either Consolidate kotlin / java toolchain or make sure there are no conflicts if they are set different within the same project.
kotlin {
    jvmToolchain {
//        check(this is JavaToolchainSpec)

863774ca99e4410e45b4d495da80c6aea438e31f

Implement Magnitude then change this to a case class

Implement Magnitude then change this to a case class

* Used to amplify a given value. // TODO: Implement Magnitude then change this to a case class

/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2015-2021 Andre White.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.truthencode.ddo.support.numbers

import enumeratum.{Enum, EnumEntry}

sealed trait Numbers extends EnumEntry

/**
 * Flags / case classes used for evaluating and typing numbers for saves / difficulty checks /
 * magnitude etc.
 */
object Numbers extends Enum[Numbers] {
  override def values: IndexedSeq[Numbers] = findValues

  /**
   * Used to amplify a given value. // TODO: Implement Magnitude then change this to a case class
   * applying [[io.truthencode.ddo.model.effect.Magnitude]]
   */
  case object Magnitude extends Numbers

  /**
   * Will be used for flagging / calculating saves / difficult checks.
   */
  case object DifficultyCheck extends Numbers
}

a897f4655425435a97c7adc02280f188f2611fb8

Add moshi-kotlin / reflect et all to kotlin-platform

Add moshi-kotlin / reflect et all to kotlin-platform

// TODO: Add moshi-kotlin / reflect et all to kotlin-platform


/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2015-2021 Andre White.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
group = "io.truthencode"
version = "0.1-SNAPSHOT"

plugins {
    `java-platform`
}

val scalaLibraryVersion: String by project

dependencies {
    constraints {

        api(libs.kotlin.reflect)
        api(libs.kotlin.stdlib)
        api(libs.kotlin.stdlib.jdk8)
        api(libs.kotlin.stdlib.jdk7)
        api(libs.kotlin.stdlib.common)
        // TODO: Add moshi-kotlin / reflect et all to kotlin-platform
    }
}

9d572ebbb5b9e13b87b043fc74882f163f8da0eb

use the Try[part] instead of the

use the Try[part] instead of the

* Sets or maps the source text for the DisplayName. // TODO: use the Try[part] instead of the

 * @tparam E
 *   Entry ID / Enumeration used to qualify which part is being modified.
 */
trait PartModifier[V, E <: EnumEntry] extends Feature[V] with DisplayName {
  self: UsingSearchPrefix =>
  /**
   * The current Seaerch-Fu is weak. Override this default function.
   */
  override lazy val part: Try[EffectPart] =
    EffectPart.tryFindByPattern(partToModify.entryName, Option(withPrefix))
  override lazy val parameters: Seq[Try[EffectParameter]] = effectParameters.map(_.parameter)
// FIXME add UsingSearchPrefix to type constraint
  override val withPrefix: String = s"$searchPrefix$nameSource"
  protected[this] val partToModify: E

  protected[this] def effectParameters: Seq[ParameterModifier[_]] = ???

  /**
   * Sets or maps the source text for the DisplayName. // TODO: use the Try[part] instead of the
   * partToModify
   *
   * @return
   *   Source text.
   */
  override protected def nameSource: String = partToModify.entryName
}

trait FeatModifier[T, E <: Feat] extends PartModifier[T, E] {
  self: UsingSearchPrefix =>

}

/**
 * A parameter that SHOULD be found in EffectParameter used for validation / stacking
 * @tparam E
 *   Enum of the parameter type being used, such as A Bonus Type of 'Action Boost'
 */
trait ParameterModifier[E <: EnumEntry] {

  lazy val parameter: Try[EffectParameter] =
    EffectParameter.tryFindByPattern(parameterToModify.entryName, None)
  protected[this] val parameterToModify: E
}

case class EffectFeature[T](
  parameter: Try[EffectParameter],
  override val part: Try[EffectPart],
  override val source: SourceInfo,
  override val categories: Seq[String],
  override val value: T,
  override val generalDescription: String,
  effectDetail: DetailedEffect)
  extends Feature[T] {
  override def parameters: Seq[Try[EffectParameter]] = ???
}

4086695ce8083c05f43414d28b0b86c6cb60742b

Support Cross-Requirement Requisites

Turn Undead has the following prerequisites:
Prerequisite: Level 1: Cleric, Level 4: Paladin, Level 20: Bane of Undeath
This requires AnyOfClass (Cleric,1),(Paladin,4) OR AnyOfEpicDestiny(Bane of Undeath)

Current logic only support Any/All/None of X.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.