init
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c095f65baddc418daab65a45333a0cd3
|
||||
timeCreated: 1677171664
|
||||
@@ -0,0 +1,21 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.ScriptableObjects;
|
||||
|
||||
namespace VOID.Generic.Status.Effect
|
||||
{
|
||||
[TypeRegistryItem("Add Status")]
|
||||
public class AddStatusEffect : BasicEffect
|
||||
{
|
||||
public BasicStatus status => _status;
|
||||
[SerializeField, Required] private BasicStatus _status;
|
||||
|
||||
public override void OnApply() => forObject.statusManager.AddStatus(_status, source);
|
||||
public override void OnEnd() {}
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() => OnEnd();
|
||||
|
||||
public override string GetSimpleDescription() => $"add status: {_status.displayName}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edb86d2e4a31453fa5ccfec9b8c55f60
|
||||
timeCreated: 1688070258
|
||||
@@ -0,0 +1,28 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using VOID.Generic.Objects.Abstract;
|
||||
using VOID.Generic.Objects.Unit;
|
||||
using VOID.ScriptableObjects;
|
||||
|
||||
namespace VOID.Generic.Status.Effect
|
||||
{
|
||||
[System.Serializable]
|
||||
public abstract class BasicEffect
|
||||
{
|
||||
[ReadOnly] protected AbstractObject forObject;
|
||||
[ReadOnly] protected BasicStatus forStatus;
|
||||
[ReadOnly] protected UnitObject source;
|
||||
|
||||
public void Init(AbstractObject forObject, BasicStatus forStatus, UnitObject source = null)
|
||||
{
|
||||
this.forObject = forObject;
|
||||
this.forStatus = forStatus;
|
||||
this.source = source;
|
||||
}
|
||||
public abstract void OnApply();
|
||||
public abstract void OnEnd();
|
||||
public abstract void OnTurnSelfStart();
|
||||
public abstract void OnTurnSelfEnd();
|
||||
public abstract void OnCancel();
|
||||
public abstract string GetSimpleDescription();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c8741ff88fd0374cbdb33240043ea3c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 23293f2e1bb4826449a1da424630f391, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a179ad85f2845f898f24fa09e245469
|
||||
timeCreated: 1675376650
|
||||
@@ -0,0 +1,54 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Abstract.Events;
|
||||
using VOID.Generic.Util;
|
||||
|
||||
namespace VOID.Generic.Status.Effect.Damage
|
||||
{
|
||||
[TypeRegistryItem("Apply Damage")]
|
||||
public class ApplyDamageEffect : BasicEffect
|
||||
{
|
||||
[InfoBox(
|
||||
"<b>" + nameof(OnApply) + "</b> - only once when effect is applied\n" +
|
||||
"<b>" + nameof(OnEnd) + "</b> - only once when effect is ended normally\n" +
|
||||
"<b>" + nameof(OnTurnSelfEnd) + "</b> - everytime when unit ends self turn\n" +
|
||||
"<b>" + nameof(OnTurnSelfStart) + "</b> - everytime when unit starts self turn\n" +
|
||||
"<b>" + nameof(OnCancel) + "</b> - only once when effect is canceled or ended forcefully"
|
||||
)]
|
||||
private enum DamageMoment
|
||||
{
|
||||
OnApply,
|
||||
OnEnd,
|
||||
OnTurnSelfEnd,
|
||||
OnTurnSelfStart,
|
||||
OnCancel
|
||||
}
|
||||
|
||||
[SerializeField] private DamageMoment _damageMoment;
|
||||
[SerializeField, Required, MinValue(0)] private int _amountMin;
|
||||
[SerializeField, Required, MinValue(nameof(_amountMin))] private int _amountMax;
|
||||
[SerializeField, Required] private DamageType _type;
|
||||
|
||||
public override void OnApply() => DoDamage(DamageMoment.OnApply);
|
||||
public override void OnEnd() => DoDamage(DamageMoment.OnEnd);
|
||||
public override void OnTurnSelfEnd() => DoDamage(DamageMoment.OnTurnSelfEnd);
|
||||
public override void OnTurnSelfStart() => DoDamage(DamageMoment.OnTurnSelfStart);
|
||||
public override void OnCancel() => DoDamage(DamageMoment.OnCancel);
|
||||
|
||||
private void DoDamage(DamageMoment thisDamageMoment)
|
||||
{
|
||||
if (thisDamageMoment != _damageMoment) return;
|
||||
|
||||
forObject.TakeDamage(new DamageEvent
|
||||
{
|
||||
target = forObject,
|
||||
attacker = source,
|
||||
amount = RandomUtil.RandomInteger(_amountMin, _amountMax),
|
||||
damageType = _type
|
||||
});
|
||||
}
|
||||
|
||||
public override string GetSimpleDescription() => $"{_amountMin} - {_amountMax} ({_type})";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fcbe2e843d4412f9992e0d8b865001c
|
||||
timeCreated: 1728394992
|
||||
@@ -0,0 +1,36 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Abstract.Events;
|
||||
using VOID.Generic.Objects.Weapon;
|
||||
using VOID.Generic.Util;
|
||||
|
||||
namespace VOID.Generic.Status.Effect.Damage
|
||||
{
|
||||
[TypeRegistryItem("Apply Weapon Damage")]
|
||||
public class WeaponDamageEffect : BasicEffect
|
||||
{
|
||||
public override void OnApply()
|
||||
{
|
||||
if (!source) return;
|
||||
|
||||
var mainHandWeapon = source.unitEquipment.GetEquipped(EquipmentSlotType.MainHand) as WeaponObject;
|
||||
var weaponDamageType = mainHandWeapon ? mainHandWeapon.weaponData.damageType : DamageType.Physical;
|
||||
var damageMin = source.unitData.subAttributes.damageMin;
|
||||
var damageMax = source.unitData.subAttributes.damageMax;
|
||||
|
||||
forObject.TakeDamage(new DamageEvent
|
||||
{
|
||||
target = forObject,
|
||||
attacker = source,
|
||||
amount = RandomUtil.RandomInteger(damageMin, damageMax),
|
||||
damageType = weaponDamageType
|
||||
});
|
||||
}
|
||||
public override void OnEnd() {}
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() {}
|
||||
|
||||
public override string GetSimpleDescription() => "?WEAPON_DAMAGE?";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 214eb872f4884fd888e86cda92ecdcb9
|
||||
timeCreated: 1728396013
|
||||
@@ -0,0 +1,36 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Unit;
|
||||
|
||||
namespace VOID.Generic.Status.Effect
|
||||
{
|
||||
[TypeRegistryItem("Change Basic Resource - Amount")]
|
||||
public class PointChangeBasicResourceEffect : BasicEffect
|
||||
{
|
||||
public int pointModificator => _pointModificator;
|
||||
public BasicResourceType basicResourceType => _basicResourceType;
|
||||
[SerializeField, Required] private int _pointModificator;
|
||||
[SerializeField, Required] private BasicResourceType _basicResourceType;
|
||||
|
||||
public override void OnApply()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_basicResourceType);
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_basicResourceType);
|
||||
}
|
||||
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() => OnEnd();
|
||||
|
||||
public sealed override string GetSimpleDescription() => $"{(_pointModificator >= 0f ? "+" : "-")}{Mathf.Abs(_pointModificator)} {_basicResourceType}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3875acf1eec74361bd843d0e330767fe
|
||||
timeCreated: 1690918692
|
||||
@@ -0,0 +1,36 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Unit;
|
||||
|
||||
namespace VOID.Generic.Status.Effect
|
||||
{
|
||||
[TypeRegistryItem("Change Main Attribute - Amount")]
|
||||
public class PointChangeMainAttributeEffect : BasicEffect
|
||||
{
|
||||
public int pointModificator => _pointModificator;
|
||||
public MainAttributeType mainAttributeType => _mainAttributeType;
|
||||
[SerializeField, Required] private int _pointModificator;
|
||||
[SerializeField, Required] private MainAttributeType _mainAttributeType;
|
||||
|
||||
public override void OnApply()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_mainAttributeType);
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_mainAttributeType);
|
||||
}
|
||||
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() => OnEnd();
|
||||
|
||||
public override string GetSimpleDescription() => $"{(_pointModificator >= 0f ? "+" : "-")}{Mathf.Abs(_pointModificator)} {_mainAttributeType}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eed5a53ca4784761b997c9da213d0e94
|
||||
timeCreated: 1690915881
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Unit;
|
||||
|
||||
namespace VOID.Generic.Status.Effect
|
||||
{
|
||||
[TypeRegistryItem("Change Sub Attribute - Amount")]
|
||||
public class PointChangeSubAttributeEffect : BasicEffect
|
||||
{
|
||||
# region Editor
|
||||
|
||||
// Disallow setting via editor weapon-related attributes - those will be managed automatically by weapon data
|
||||
private IEnumerable GetSubAttributeTypes() => Enum.GetValues(typeof(SubAttributeType)).Cast<SubAttributeType>()
|
||||
.Where(aubAttributeType => aubAttributeType is not SubAttributeType.DamageMin and not SubAttributeType.DamageMax
|
||||
and not SubAttributeType.CriticalDamageChance and not SubAttributeType.CriticalDamageMultiplier)
|
||||
.Select(subAttributeType => new ValueDropdownItem(Enum.GetName(typeof(SubAttributeType), subAttributeType), (int)subAttributeType));
|
||||
|
||||
# endregion
|
||||
|
||||
public int pointModificator => _pointModificator;
|
||||
public SubAttributeType subAttributeType => _subAttributeType;
|
||||
[SerializeField, Required] private int _pointModificator;
|
||||
[SerializeField, Required, ValueDropdown(nameof(GetSubAttributeTypes))] private SubAttributeType _subAttributeType;
|
||||
|
||||
public override void OnApply()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_subAttributeType);
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_subAttributeType);
|
||||
}
|
||||
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() => OnEnd();
|
||||
|
||||
public override string GetSimpleDescription() => $"{(_pointModificator >= 0f ? "+" : "-")}{Mathf.Abs(_pointModificator)} {_subAttributeType}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14327627dbfe47dd851e4d8a40f81d53
|
||||
timeCreated: 1690919416
|
||||
@@ -0,0 +1,36 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Unit;
|
||||
|
||||
namespace VOID.Generic.Status.Effect
|
||||
{
|
||||
[TypeRegistryItem("Change Unit Resource - Amount")]
|
||||
public class PointChangeUnitResourceEffect : BasicEffect
|
||||
{
|
||||
public int pointModificator => _pointModificator;
|
||||
public UnitResourceType unitResourceType => _unitResourceType;
|
||||
[SerializeField, Required] private int _pointModificator;
|
||||
[SerializeField, Required] private UnitResourceType _unitResourceType;
|
||||
|
||||
public override void OnApply()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_unitResourceType);
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
|
||||
forUnit.unitDataCalculator.Queue(_unitResourceType);
|
||||
}
|
||||
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() => OnEnd();
|
||||
|
||||
public sealed override string GetSimpleDescription() => $"{(_pointModificator >= 0f ? "+" : "-")}{Mathf.Abs(_pointModificator)} {_unitResourceType}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ba4e07e53854225846754e59547843e
|
||||
timeCreated: 1695472556
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 607a21e8010141bb8d5f60dfc8dc2af3
|
||||
timeCreated: 1723586283
|
||||
@@ -0,0 +1,101 @@
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.Generic.Objects.Unit;
|
||||
using VOID.Generic.Objects.Unit.Events;
|
||||
using VOID.Generic.Projectile;
|
||||
using VOID.ScriptableObjects;
|
||||
|
||||
namespace VOID.Generic.Status.Effect.Positional
|
||||
{
|
||||
[TypeRegistryItem("Jump")]
|
||||
public class JumpEffect : BasicEffect
|
||||
{
|
||||
private enum JumpEffectState
|
||||
{
|
||||
Pre,
|
||||
Waiting,
|
||||
Jump,
|
||||
End
|
||||
}
|
||||
|
||||
private JumpEffectState _state;
|
||||
private ProjectileObject _projectile;
|
||||
private UnitObject _forUnit;
|
||||
|
||||
public override void OnApply()
|
||||
{
|
||||
if (forObject is not UnitObject forUnit) return;
|
||||
_forUnit = forUnit;
|
||||
|
||||
if (_state == JumpEffectState.Pre)
|
||||
{
|
||||
// "PRE" is firing from ability, but this will fire instant effect
|
||||
// Here we will create new status+effect for jump that will handle whole jump
|
||||
var newJumpEffect = new JumpEffect();
|
||||
newJumpEffect._state = JumpEffectState.Waiting;
|
||||
|
||||
var newJumpStatus = ScriptableObject.CreateInstance<BasicStatus>();
|
||||
newJumpStatus.effects = new List<BasicEffect> { newJumpEffect };
|
||||
newJumpStatus.hidden = true;
|
||||
newJumpStatus.permanent = true;
|
||||
_forUnit.statusManager.AddStatus(newJumpStatus, _forUnit, false);
|
||||
}
|
||||
else if (_state == JumpEffectState.Waiting)
|
||||
{
|
||||
// "WAITING" this state is waiting for projectile to fire, after that unit can attach to projectile
|
||||
_forUnit.unitEvents.onAbilityProjectileStart.AddListener(OnProjectileStart);
|
||||
_forUnit.unitEvents.onAbilityProjectileEnd.AddListener(OnProjectileEnd);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (!_forUnit) return;
|
||||
|
||||
// Just to be sure - remove all listeners after jump is finished
|
||||
_forUnit.basicEvents.onFixedUpdate.RemoveListener(MoveWithProjectile);
|
||||
_forUnit.unitEvents.onAbilityProjectileStart.RemoveListener(OnProjectileStart);
|
||||
_forUnit.unitEvents.onAbilityProjectileEnd.RemoveListener(OnProjectileEnd);
|
||||
}
|
||||
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() => OnEnd();
|
||||
|
||||
public sealed override string GetSimpleDescription() => "Unit jump like a projectile";
|
||||
|
||||
private void OnProjectileStart(AbilityProjectileEvent projectileEvent)
|
||||
{
|
||||
// just to be sure that unit stick only to first projectile, if somehow there is more
|
||||
if (projectileEvent.projectileIndex != 0) return;
|
||||
|
||||
_projectile = projectileEvent.projectile;
|
||||
_state = JumpEffectState.Jump;
|
||||
|
||||
_forUnit.basicEvents.onFixedUpdate.AddListener(MoveWithProjectile);
|
||||
|
||||
_forUnit.unitEvents.onAbilityProjectileStart.RemoveListener(OnProjectileStart);
|
||||
}
|
||||
|
||||
private void OnProjectileEnd(AbilityProjectileEvent projectileEvent)
|
||||
{
|
||||
// just to be sure that unit stick only to first projectile, if somehow there is more
|
||||
if (projectileEvent.projectileIndex != 0) return;
|
||||
|
||||
_state = JumpEffectState.End;
|
||||
|
||||
_forUnit.basicEvents.onFixedUpdate.RemoveListener(MoveWithProjectile);
|
||||
|
||||
_forUnit.unitEvents.onAbilityProjectileEnd.RemoveListener(OnProjectileEnd);
|
||||
|
||||
// End whole jump status when projectile along with unit end their "jump"
|
||||
forStatus.End();
|
||||
}
|
||||
|
||||
private void MoveWithProjectile()
|
||||
{
|
||||
_forUnit.transform.position = _projectile.transform.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8353af9e62844d6b6934c8a4666ed70
|
||||
timeCreated: 1723586320
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 441be07b01314ac88bb0fc97a0b72ec7
|
||||
timeCreated: 1728047067
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace VOID.Generic.Status.Effect.Visual
|
||||
{
|
||||
[TypeRegistryItem("Apply VFX")]
|
||||
public class ApplyVFXEffect : BasicEffect
|
||||
{
|
||||
[InfoBox(
|
||||
"<b>" + nameof(Never) + "</b> - never will be destroyed, by this effect\n" +
|
||||
"<b>" + nameof(OnParticleSystemEnd) + "</b> - will be destroyed after longest duration of " + nameof(ParticleSystem) + "\n" +
|
||||
"<b>" + nameof(OnFixedTime) + "</b> - will be destroyed after given time in seconds"
|
||||
)]
|
||||
private enum DestroyMoment
|
||||
{
|
||||
Never,
|
||||
OnParticleSystemEnd,
|
||||
OnFixedTime
|
||||
}
|
||||
|
||||
[SerializeField, Required] private GameObject _vfxPrefab;
|
||||
[SerializeField] private DestroyMoment _destroyMoment;
|
||||
[SerializeField, ShowIf(nameof(_destroyMoment), DestroyMoment.OnFixedTime)] private float _secondsUntilDestroy;
|
||||
|
||||
private GameObject _vfxGameObject;
|
||||
|
||||
public override void OnApply()
|
||||
{
|
||||
_vfxGameObject = Object.Instantiate(_vfxPrefab, forObject.transform, false);
|
||||
|
||||
switch (_destroyMoment)
|
||||
{
|
||||
case DestroyMoment.Never:
|
||||
break;
|
||||
case DestroyMoment.OnParticleSystemEnd:
|
||||
DestroyOnDurationEnd();
|
||||
break;
|
||||
case DestroyMoment.OnFixedTime:
|
||||
DestroyOnFixedTime();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyOnDurationEnd()
|
||||
{
|
||||
var duration = _vfxGameObject
|
||||
.GetComponentsInChildren<ParticleSystem>()
|
||||
.Select(ps => ps.main.duration)
|
||||
.Max();
|
||||
Object.Destroy(_vfxGameObject, duration);
|
||||
}
|
||||
|
||||
private void DestroyOnFixedTime()
|
||||
{
|
||||
Object.Destroy(_vfxGameObject, _secondsUntilDestroy);
|
||||
}
|
||||
|
||||
public override void OnEnd() {}
|
||||
public override void OnTurnSelfEnd() {}
|
||||
public override void OnTurnSelfStart() {}
|
||||
public override void OnCancel() => OnEnd();
|
||||
|
||||
public override string GetSimpleDescription() => $"add visual effects: {_vfxPrefab.name}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed699864a59740d388c9c2d31042a72f
|
||||
timeCreated: 1728047132
|
||||
Reference in New Issue
Block a user