Implemented darkness effect (#5402)

This commit is contained in:
Javier León 2022-11-10 09:57:14 -03:00 committed by GitHub
parent 069062f122
commit d03bbb0426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,7 @@ final class EffectIdMap{
//TODO: SLOW_FALLING
//TODO: BAD_OMEN
//TODO: VILLAGE_HERO
$this->register(EffectIds::DARKNESS, VanillaEffects::DARKNESS());
}
//TODO: not a big fan of the code duplication here :(

View File

@ -58,4 +58,5 @@ final class EffectIds{
public const SLOW_FALLING = 27;
public const BAD_OMEN = 28;
public const VILLAGE_HERO = 29;
public const DARKNESS = 30;
}

View File

@ -40,6 +40,7 @@ final class StringToEffectParser extends StringToTParser{
$result->register("absorption", fn() => VanillaEffects::ABSORPTION());
$result->register("blindness", fn() => VanillaEffects::BLINDNESS());
$result->register("conduit_power", fn() => VanillaEffects::CONDUIT_POWER());
$result->register("darkness", fn() => VanillaEffects::DARKNESS());
$result->register("fatal_poison", fn() => VanillaEffects::FATAL_POISON());
$result->register("fire_resistance", fn() => VanillaEffects::FIRE_RESISTANCE());
$result->register("haste", fn() => VanillaEffects::HASTE());

View File

@ -36,6 +36,7 @@ use pocketmine\utils\RegistryTrait;
* @method static AbsorptionEffect ABSORPTION()
* @method static Effect BLINDNESS()
* @method static Effect CONDUIT_POWER()
* @method static Effect DARKNESS()
* @method static PoisonEffect FATAL_POISON()
* @method static Effect FIRE_RESISTANCE()
* @method static Effect HASTE()
@ -68,6 +69,7 @@ final class VanillaEffects{
//TODO: bad_omen
self::register("blindness", new Effect(KnownTranslationFactory::potion_blindness(), new Color(0x1f, 0x1f, 0x23), true));
self::register("conduit_power", new Effect(KnownTranslationFactory::potion_conduitPower(), new Color(0x1d, 0xc2, 0xd1)));
self::register("darkness", new Effect(KnownTranslationFactory::effect_darkness(), new Color(0x29, 0x27, 0x21), true, 600, false));
self::register("fatal_poison", new PoisonEffect(KnownTranslationFactory::potion_poison(), new Color(0x4e, 0x93, 0x31), true, 600, true, true));
self::register("fire_resistance", new Effect(KnownTranslationFactory::potion_fireResistance(), new Color(0xe4, 0x9a, 0x3a)));
self::register("haste", new Effect(KnownTranslationFactory::potion_digSpeed(), new Color(0xd9, 0xc0, 0x43)));