Magic rings (#378)

* flame creation spell backend

* flame creation visuals

* flame creation spell visual

* tweak

* some tweaks

* ice dagger spell

* move spells to rings

* Update ring.yml

* fix server crash
This commit is contained in:
Ed
2024-08-02 00:48:36 +03:00
committed by GitHub
parent 56da23925f
commit 31c9485e3b
32 changed files with 504 additions and 27 deletions

View File

@@ -22,7 +22,7 @@ public sealed partial class CP14MagicSystem : CP14SharedMagicSystem
private void OnSpellSpoken(Entity<CP14MagicEffectVerbalAspectComponent> ent, ref CP14VerbalAspectSpeechEvent args)
{
if (args.Performer is not null && args.Speech is not null)
_chat.TrySendInGameICMessage(args.Performer.Value, args.Speech, InGameICChatType.Speak, false);
_chat.TrySendInGameICMessage(args.Performer.Value, args.Speech, InGameICChatType.Speak, true);
}
private void OnSpawnMagicVisualEffect(Entity<CP14MagicEffectCastingVisualComponent> ent, ref CP14StartCastMagicEffectEvent args)

View File

@@ -36,8 +36,11 @@ public sealed partial class CP14SharedMagicAttuningSystem : EntitySystem
if (!_mind.TryGetMind(ent, out var mindId, out var mind))
return;
var attuneMind = AddComp<CP14MagicAttuningMindComponent>(mindId);
attuneMind.MaxAttuning = ent.Comp.MaxAttuning;
if (!HasComp<CP14MagicAttuningMindComponent>(mindId))
{
var attuneMind = AddComp<CP14MagicAttuningMindComponent>(mindId);
attuneMind.MaxAttuning = ent.Comp.MaxAttuning;
}
}
public bool IsAttunedTo(EntityUid mind, EntityUid item)

View File

@@ -107,11 +107,14 @@ public partial class CP14SharedMagicSystem : EntitySystem
{
if (TryComp<HandsComponent>(args.Performer, out var hands) || hands is not null)
{
var freeHand = 0;
foreach (var hand in hands.Hands)
{
if (hand.Value.IsEmpty)
return;
freeHand++;
}
if (freeHand >= ent.Comp.FreeHandRequired)
return;
}
args.PushReason(Loc.GetString("cp14-magic-spell-need-somatic-component"));
args.Cancel();
@@ -168,6 +171,7 @@ public partial class CP14SharedMagicSystem : EntitySystem
{
BreakOnMove = delayedEffect.BreakOnMove,
BreakOnDamage = delayedEffect.BreakOnDamage,
BlockDuplicate = true,
};
_doAfter.TryStartDoAfter(doAfterEventArgs);
@@ -195,6 +199,7 @@ public partial class CP14SharedMagicSystem : EntitySystem
{
BreakOnMove = delayedEffect.BreakOnMove,
BreakOnDamage = delayedEffect.BreakOnDamage,
BlockDuplicate = true,
};
_doAfter.TryStartDoAfter(doAfterEventArgs);
@@ -217,6 +222,7 @@ public partial class CP14SharedMagicSystem : EntitySystem
{
BreakOnMove = delayedEffect.BreakOnMove,
BreakOnDamage = delayedEffect.BreakOnDamage,
BlockDuplicate = true,
};
_doAfter.TryStartDoAfter(doAfterEventArgs);

View File

@@ -6,4 +6,6 @@ namespace Content.Shared._CP14.MagicSpell.Components;
[RegisterComponent, Access(typeof(CP14SharedMagicSystem))]
public sealed partial class CP14MagicEffectSomaticAspectComponent : Component
{
[DataField]
public int FreeHandRequired = 1;
}

View File

@@ -0,0 +1,31 @@
using Content.Shared.Hands.EntitySystems;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.MagicSpell.Spells;
public sealed partial class CP14SpellSpawnInHandEntity : CP14SpellEffect
{
[DataField]
public List<EntProtoId> Spawns = new();
[DataField]
public bool DeleteIfCantPickup = false;
public override void Effect(EntityManager entManager, CP14SpellEffectBaseArgs args)
{
if (args.Target is null)
return;
if (!entManager.TryGetComponent<TransformComponent>(args.Target.Value, out var transformComponent))
return;
var handSystem = entManager.System<SharedHandsSystem>();
foreach (var spawn in Spawns)
{
var item = entManager.SpawnAtPosition(spawn, transformComponent.Coordinates);
if (!handSystem.TryPickupAnyHand(args.Target.Value, item) && DeleteIfCantPickup)
entManager.QueueDeleteEntity(item);
}
}
}

View File

@@ -7,4 +7,7 @@ cp14-magic-spell-not-enough-mana-cast-warning-3 = Your throat starts to lump...
cp14-magic-spell-not-enough-mana-cast-warning-4 = Your head becomes heavy...
cp14-magic-energy-damage-burn-out = The pain is piercing your body!
cp14-magic-energy-damage-burn-out-fall = You pass out from the intense pain!
cp14-magic-energy-damage-burn-out-fall = You pass out from the intense pain!
cp14-magic-spell-need-verbal-component = You can't cast the spell out loud.
cp14-magic-spell-need-somatic-component = You don't have your hands free.

View File

@@ -10,4 +10,4 @@ cp14-magic-energy-damage-burn-out = Боль пронзает ваше тело!
cp14-magic-energy-damage-burn-out-fall = Вы теряете сознание от сильной боли!
cp14-magic-spell-need-verbal-component = Вы не можете произнести заклинание вслух.
cp14-magic-spell-need-somatic-component = Вам нужна свободная рука.
cp14-magic-spell-need-somatic-component = Вам не хватает свободных рук.

View File

@@ -4,6 +4,8 @@
description: manifestation of magical energy in the physical plane
abstract: true
components:
- type: TimedDespawn
lifetime: 10
- type: Sprite
noRot: true
drawDepth: FloorTiles

View File

@@ -4,29 +4,32 @@
description: You touch the creature, healing its body from physical damage
components:
- type: CP14MagicEffect
manaCost: 10
manaCost: 15
effects:
- !type:CP14SpellSpawnEntity
spawns:
- CP14CureWoundsImpactEffect
- CP14ImpactEffectCureWounds
- !type:CP14SpellApplyEntityEffect
effects:
- !type:HealthChange
damage:
types:
Slash: -8
Blunt: -8
Piercing: -8
Heat: -8
Slash: -10
Blunt: -10
Piercing: -10
Heat: -10
- !type:Jitter
- type: CP14MagicEffectVerbalAspect
startSpeech: "Et curabuntur..."
endSpeech: "vulnera tua"
- type: CP14MagicEffectSomaticAspect
- type: CP14MagicEffectCastingVisual
proto: CP14CureWoundsRune
proto: CP14RuneCureWounds
- type: EntityTargetAction
useDelay: 5
whitelist:
components:
- MobState
useDelay: 10
itemIconStyle: BigAction
interactOnMiss: false
sound: !type:SoundPathSpecifier
@@ -38,9 +41,9 @@
delay: 2
- type: entity
id: CP14CureWoundsRune
noSpawn: true
id: CP14RuneCureWounds
parent: CP14BaseMagicRune
categories: [ HideSpawnMenu ]
components:
- type: PointLight
color: "#328643"
@@ -51,9 +54,9 @@
shader: unshaded
- type: entity
id: CP14CureWoundsImpactEffect
id: CP14ImpactEffectCureWounds
parent: CP14BaseMagicImpact
noSpawn: true
categories: [ HideSpawnMenu ]
components:
- type: Sprite
layers:

View File

@@ -0,0 +1,138 @@
- type: entity
id: CP14ActionSpellFlameCreation
name: Flame creation
description: A artificial flame forms in your hand, illuminating your surroundings. You can throw it to use it as a disposable weapon.
components:
- type: CP14MagicEffect
manaCost: 5
effects:
- !type:CP14SpellSpawnEntity
spawns:
- CP14ImpactEffectFlameCreation
- !type:CP14SpellSpawnInHandEntity
spawns:
- CP14FlameCreationArtificialFlame
- type: CP14MagicEffectVerbalAspect
startSpeech: "Et conteret ignis..."
endSpeech: "in manu mea"
- type: CP14MagicEffectSomaticAspect
- type: CP14MagicEffectCastingVisual
proto: CP14RuneFlameCreation
- type: InstantAction
useDelay: 10
itemIconStyle: BigAction
sound: !type:SoundPathSpecifier
path: /Audio/Magic/rumble.ogg
icon:
sprite: _CP14/Effects/Magic/spells_icons.rsi
state: flame_creation
event: !type:CP14DelayedInstantActionEvent
delay: 1
- type: entity
id: CP14RuneFlameCreation
parent: CP14BaseMagicRune
categories: [ HideSpawnMenu ]
components:
- type: PointLight
color: "#eea911"
- type: Sprite
layers:
- state: sun
color: "#eea911"
shader: unshaded
- type: entity
id: CP14ImpactEffectFlameCreation
parent: CP14BaseMagicImpact
categories: [ HideSpawnMenu ]
components:
- type: Sprite
layers:
- state: particles_up
color: "#eea911"
shader: unshaded
- type: entity
id: CP14FlameCreationArtificialFlame
parent:
- BaseItem
- ItemHeftyBase
name: artificial flame
description: A magically created artificial flame burning directly into the air. Not a bad light source, or a weapon if you throw it in someone's face.
components:
- type: Item
size: Ginormous
inhandVisuals:
left:
- state: inhand-left
shader: unshaded
right:
- state: inhand-right
shader: unshaded
- type: TimedDespawn
lifetime: 300 # 5 min
- type: Sprite
sprite: _CP14/Objects/Misc/artificial_flame.rsi
layers:
- state: icon
shader: unshaded
- type: PointLight
color: "#eea911"
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.2,-0.2,0.2,0.2"
density: 30
hard: true
mask:
- ItemMask
- type: DamageOnHighSpeedImpact
minimumSpeed: 0.1
damage:
types:
Blunt: 3
- type: Damageable
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 1
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- !type:PlaySoundBehavior
sound:
path: /Audio/Weapons/Guns/Hits/energy_meat1.ogg
params:
variation: 0.250
volume: -12
- type: ThrowingAngle
angle: 0
- type: LandAtCursor
- type: CP14MeleeSelfDamage
damageToSelf:
types:
Blunt: 0.5 # 2 hits
- type: DamageOtherOnHit
damage:
types:
Heat: 8
- type: MeleeWeapon
attackRate: 1.8
wideAnimationRotation: 225
wideAnimation: CP14WeaponArcSlash
damage:
types:
Heat: 5
soundHit:
path: /Audio/Weapons/Guns/Hits/energy_meat1.ogg
params:
variation: 0.250
volume: -12
cPAnimationLength: 0.15
- type: IgnitionSource
temperature: 400
ignited: true

View File

@@ -0,0 +1,89 @@
- type: entity
id: CP14ActionSpellIceDagger
name: Ice dagger
description: Materialization of a temporary sharp ice throwing dagger
components:
- type: CP14MagicEffect
manaCost: 15
effects:
- !type:CP14SpellSpawnEntity
spawns:
- CP14ImpactEffectIceDagger
- !type:CP14SpellSpawnInHandEntity
spawns:
- CP14DaggerIce
- type: CP14MagicEffectSomaticAspect
- type: CP14MagicEffectCastingVisual
proto: CP14RuneIceDagger
- type: InstantAction
useDelay: 15
itemIconStyle: BigAction
sound: !type:SoundPathSpecifier
path: /Audio/Magic/rumble.ogg
icon:
sprite: _CP14/Effects/Magic/spells_icons.rsi
state: ice_dagger
event: !type:CP14DelayedInstantActionEvent
delay: 0.5
- type: entity
id: CP14RuneIceDagger
parent: CP14BaseMagicRune
categories: [ HideSpawnMenu ]
components:
- type: PointLight
color: "#5eabeb"
- type: Sprite
layers:
- state: medium_line
color: "#5eabeb"
shader: unshaded
- type: entity
id: CP14ImpactEffectIceDagger
parent: CP14BaseMagicImpact
categories: [ HideSpawnMenu ]
components:
- type: Sprite
layers:
- state: particles_up
color: "#5eabeb"
shader: unshaded
- type: entity
id: CP14DaggerIce
parent:
- CP14BaseDagger
name: ice dagger
description: A piece of sharp magical ice. In a little while, the spell will wear off, and he will disappear.
components:
- type: TimedDespawn
lifetime: 60 # 1 min
- type: Clothing
sprite: _CP14/Objects/Weapons/Melee/Dagger/ice_dagger.rsi
- type: Sprite
sprite: _CP14/Objects/Weapons/Melee/Dagger/ice_dagger.rsi
- type: CP14Currency
currency: 0
- type: MeleeWeapon
damage:
types:
Slash: 2
Piercing: 2
Cold: 2
- type: DamageOtherOnHit
damage:
types:
Piercing: 5
Cold: 5
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 10
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:DoActsBehavior
acts: ["Destruction"]

View File

@@ -0,0 +1,63 @@
- type: entity
abstract: true
parent: Clothing
id: CP14ClothingRingBase
components:
- type: Item
size: Tiny
- type: Clothing
slots:
- ring
- type: Sprite
sprite: _CP14/Clothing/Rings/rings.rsi
- type: entity
id: CP14ClothingRingIceDagger
parent: CP14ClothingRingBase
name: conductive ring
description: A standard mana-conductive ring that allows the user to summon ice daggers.
components:
- type: Sprite
layers:
- state: brass_ring
- state: saphhire_stone_small
- type: CP14SpellStorageRequireAttune
- type: CP14MagicAttuningItem
- type: CP14SpellStorageAccessWearing
- type: CP14SpellStorage
spells:
- CP14ActionSpellIceDagger
- type: entity
id: CP14ClothingRingFlameCreation
parent: CP14ClothingRingBase
name: conductive ring
description: A standard mana-conductive ring that allows the user to summon artificial flames.
components:
- type: Sprite
layers:
- state: brass_ring
- state: ruby_stone_small
- type: CP14SpellStorageRequireAttune
- type: CP14MagicAttuningItem
- type: CP14SpellStorageAccessWearing
- type: CP14SpellStorage
spells:
- CP14ActionSpellFlameCreation
- type: entity
id: CP14ClothingRingCureWounds
parent: CP14ClothingRingBase
name: conductive ring
description: A standard mana-conductive ring that allows the user to heal physical injuries.
components:
- type: Sprite
layers:
- state: brass_ring
- state: emerald_stone_small
- type: CP14SpellStorageRequireAttune
- type: CP14MagicAttuningItem
- type: CP14SpellStorageAccessWearing
- type: CP14SpellStorage
spells:
- CP14ActionSpellCureWounds

View File

@@ -7,11 +7,4 @@
sprite: Objects/Specific/Hydroponics/seeds.rsi
state: seed
- type: CP14Seed
plantProto: CP14PlantWheat
- type: CP14MagicAttuningItem
focusTime: 1
- type: CP14SpellStorageAccessHolding
- type: CP14SpellStorage
spells:
- CP14ActionSpellCureWounds
- type: CP14SpellStorageRequireAttune
plantProto: CP14PlantWheat

View File

@@ -5,7 +5,6 @@
- CP14BaseWeaponDestructible
- CP14BaseWeaponSharp
- CP14BaseWeaponChemical
- CP14BaseWeaponLight
name: sword
description: the gold standard of edged weapons. Medium length, comfortable grip. No frills.
components:

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

View File

@@ -0,0 +1,23 @@
{
"version": 1,
"license": "All rights reserved for the CrystallPunk14 project only",
"copyright": "CrystallPunk14, by TheShuEd",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "brass_ring"
},
{
"name": "saphhire_stone_small"
},
{
"name": "ruby_stone_small"
},
{
"name": "emerald_stone_small"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -9,6 +9,12 @@
"states": [
{
"name": "cure_wounds"
},
{
"name": "flame_creation"
},
{
"name": "ice_dagger"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,86 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "All rights reserved for the CrystallPunk14 project only",
"copyright": "Created by TheShuEd for CrystallPunk",
"states": [
{
"name": "icon",
"delays": [
[
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2
]
]
},
{
"name": "inhand-left",
"directions": 4,
"delays": [
[
0.2,
0.2,
0.2,
0.2
],
[
0.2,
0.2,
0.2,
0.2
],
[
0.2,
0.2,
0.2,
0.2
],
[
0.2,
0.2,
0.2,
0.2
]
]
},
{
"name": "inhand-right",
"directions": 4,
"delays": [
[
0.2,
0.2,
0.2,
0.2
],
[
0.2,
0.2,
0.2,
0.2
],
[
0.2,
0.2,
0.2,
0.2
],
[
0.2,
0.2,
0.2,
0.2
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

View File

@@ -0,0 +1,30 @@
{
"version": 1,
"license": "All rights reserved for the CrystallPunk14 project only",
"copyright": "Created by TheShuEd (Github) for CrystallPunk",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "icon"
},
{
"name": "inhand-left",
"directions": 4
},
{
"name": "inhand-right",
"directions": 4
},
{
"name": "equipped-BELT1",
"directions": 4
},
{
"name": "equipped-BELT2",
"directions": 4
}
]
}