Skip to content

Commit

Permalink
Created the Party Poison affix
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanPB committed Jul 29, 2020
1 parent 6b6eb2d commit 20685ce
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/main/kotlin/dev/nathanpb/dml/config/ModConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ class TrialAffix : ConfigData {
var enableMobSpeed = true
var enableMobResistance = true
var enableThunderstorm = true
var enablePartyPoison = true

var thunderstormBoltChance = .05F
var partyPoisonChance = .005F

override fun validatePostLoad() {
maxAffixesInKey = max(0, maxAffixesInKey)
Expand Down
51 changes: 51 additions & 0 deletions src/main/kotlin/dev/nathanpb/dml/trial/affix/PartyPoisonAffix.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 Nathan P. Bombana, IterationFunk
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
*/

package dev.nathanpb.dml.trial.affix

import dev.nathanpb.dml.config
import dev.nathanpb.dml.identifier
import dev.nathanpb.dml.trial.Trial
import dev.nathanpb.dml.trial.TrialState
import dev.nathanpb.dml.trial.affix.core.TrialAffix
import dev.nathanpb.dml.utils.toVec3d
import net.minecraft.entity.projectile.thrown.PotionEntity
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.potion.PotionUtil
import net.minecraft.potion.Potions
import net.minecraft.text.LiteralText
import kotlin.random.Random

class PartyPoisonAffix : TrialAffix(identifier("party_poison")), TrialAffix.TickableAffix {

override fun isEnabled() = config.affix.enablePartyPoison

override fun tick(trial: Trial) {
if (trial.state == TrialState.RUNNING && Random.nextFloat() < config.affix.partyPoisonChance) {

(0..360).step(16).forEach { angle ->
val potionEntity = PotionEntity(trial.world, trial.systemGlitch)
trial.pos.toVec3d().apply {
potionEntity.setPos(x, y+1, z)
}
val stack = ItemStack(Items.SPLASH_POTION)
PotionUtil.setPotion(stack, Potions.POISON)
potionEntity.setItem(stack)
potionEntity.setProperties(trial.systemGlitch, -60F, angle.toFloat(), -20.0f, 0.5f, 1.0f)
trial.world.spawnEntity(potionEntity)
}

if (Random.nextFloat() < .01F) {
trial.players.forEach {
it.sendMessage(LiteralText("Hide your eyes, we're gonna shine tonight"), false)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
package dev.nathanpb.dml.trial.affix.core

import dev.nathanpb.dml.event.TrialWaveSpawnCallback
import dev.nathanpb.dml.trial.affix.MobResistanceTrialAffix
import dev.nathanpb.dml.trial.affix.MobSpeedTrialAffix
import dev.nathanpb.dml.trial.affix.MobStrengthTrialAffix
import dev.nathanpb.dml.trial.affix.ThunderstormAffix
import dev.nathanpb.dml.trial.affix.*
import dev.nathanpb.dml.utils.randomOrNull
import net.minecraft.util.Identifier
import org.jetbrains.annotations.ApiStatus
Expand All @@ -28,6 +25,7 @@ class TrialAffixRegistry private constructor() {
INSTANCE.register(MobSpeedTrialAffix())
INSTANCE.register(MobResistanceTrialAffix())
INSTANCE.register(ThunderstormAffix())
INSTANCE.register(PartyPoisonAffix())
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/dml-refabricated/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@
"text.autoconfig.dml-refabricated.option.affix.enableMobResistance": "Enable Road of Resistance",
"text.autoconfig.dml-refabricated.option.affix.enableThunderstorm": "Enable Thunderstorm",
"text.autoconfig.dml-refabricated.option.affix.thunderstormBoltChance": "Thunderstorm Lightning Chance",
"text.autoconfig.dml-refabricated.option.affix.partyPoisonChance": "Party Poison Chance",
"rei.dml-refabricated.category.crushing": "Crushing Recipe",
"rei.dml-refabricated.category.trial": "Trial",
"rei.dml-refabricated.category.loot_fabricator": "Loot Fabricator",
"affix.dml-refabricated.mob_strength.name": "Mob Strength",
"affix.dml-refabricated.mob_speed.name": "Mob Speed",
"affix.dml-refabricated.mob_resistance.name": "Road of Resistance",
"affix.dml-refabricated.thunderstorm.name": "Thunderstorm"
"affix.dml-refabricated.thunderstorm.name": "Thunderstorm",
"affix.dml-refabricated.party_poison.name": "Party Poison"
}

0 comments on commit 20685ce

Please sign in to comment.