AttackResult修改

This commit is contained in:
SoulliesOfficial
2025-11-08 22:22:43 -05:00
parent b2e9e84c52
commit 1bca620966
21 changed files with 211 additions and 37 deletions

View File

@@ -92,12 +92,13 @@ MonoBehaviour:
hudDataIDList:
- HUDData_Basic_Default
localizationFiles:
- {fileID: 4900000, guid: 9072c63645396754ab7c90a266d2e6f8, type: 3}
- {fileID: 4900000, guid: b07b620f4c7256843b55609e43977ced, type: 3}
- {fileID: 4900000, guid: 189619dba501d344ea1d0f59202d9e6d, type: 3}
- {fileID: 4900000, guid: c3a2d38972f95ed41aa340ad6c5ca3b5, type: 3}
- {fileID: 4900000, guid: dae5bc8e90366584ca78827dfe470a23, type: 3}
- {fileID: 4900000, guid: 769aea741717c4a4bbf3c474056da92f, type: 3}
- {fileID: 4900000, guid: e1ad01987651df444878ed7e1da1b9c8, type: 3}
- {fileID: 4900000, guid: 5d66745b8665526429012762a60469bd, type: 3}
- {fileID: 4900000, guid: b8e11e42fa0f82c41a2cb84cd79ccb79, type: 3}
- {fileID: 4900000, guid: dae5bc8e90366584ca78827dfe470a23, type: 3}
- {fileID: 4900000, guid: 9072c63645396754ab7c90a266d2e6f8, type: 3}
- {fileID: 4900000, guid: 240d7d7c1050c1c498575d637265ab32, type: 3}
- {fileID: 4900000, guid: 189619dba501d344ea1d0f59202d9e6d, type: 3}
- {fileID: 4900000, guid: 769aea741717c4a4bbf3c474056da92f, type: 3}
- {fileID: 4900000, guid: e1ad01987651df444878ed7e1da1b9c8, type: 3}

View File

@@ -43,17 +43,13 @@ MonoBehaviour:
index: 3
isKeyDuplicated: 0
- Key: BuffStack_WD
Value: 1
Value: 4
index: 4
isKeyDuplicated: 0
- Key: DamageCount
Value: 20
index: 5
isKeyDuplicated: 0
- Key: BuffStack_Corrosion
Value: 4
index: 6
isKeyDuplicated: 0
dividerPosProp: 0.5
originalAttributes:
dictionaryList: []

View File

@@ -54,5 +54,5 @@ MonoBehaviour:
customDescriptions: []
prefabRefs: []
derivativeCardDataRefs:
- CardData_Basic_Strike
- CardData_Basic_Tactic
derivativeCharacterDataRefs: []

View File

@@ -14,7 +14,7 @@ namespace Continentis.Mods.Basic.Cards
CommandGroup mainGroup = TargetListCommandGroup(targetList,
new Cmd_ParamFunction<CharacterBase>(0.05f, target =>
{
CreateCharacterBuff<Buffs.WoundDeterioration>(GetAttribute("BuffStack_WD")).Apply(target, user, this);
CreateCharacterBuff<Buffs.WoundDeterioration>(GetAttribute("BuffStack_WD"), GetAttribute("DamageCount")).Apply(target, user, this);
}));
return new List<CommandBase> { mainGroup };
}

View File

@@ -20,8 +20,8 @@ namespace Continentis.Mods.Basic.Cards
mainGroup.AddCommand(new Cmd_PlayAnimation(user.characterView, "Skill"));
mainGroup.AddCommand(new Cmd_Function(() =>
{
CardData holyWaterCardData = GetDerivativeCardData(0);
CardInstance.GenerateCardInstance(holyWaterCardData, user.team, "Hand");
CardData tacticData = GetDerivativeCardData(0);
CardInstance.GenerateCardInstance(tacticData, user.team, "Hand");
}));
return new List<CommandBase> { mainGroup };

View File

@@ -30,7 +30,10 @@ namespace Continentis.Mods.Basic.Cards
}
CommandGroup occupiedGroup = new CommandGroup(ExecutionMode.Sequential, new Cmd_Function(1, ()=>
{
Debug.Log("不插队指令,先于攻击触发,如果先执行抽牌说明插队成功");
CommandQueueManager.Instance.AddCommand(new Cmd_Function(() =>
{
Debug.Log("插队指令,等待动画播放完毕");
}), false);
}));
CommandGroup mainGroup = TargetListCommandGroup(targetList, ExecutionMode.Sequential, ExecutionMode.Sequential, templates.ToArray());
CommandGroup finalGroup = new CommandGroup(ExecutionMode.Sequential, new Cmd_Function(()=>
@@ -39,7 +42,7 @@ namespace Continentis.Mods.Basic.Cards
}));
CommandGroup firstGroup = new CommandGroup(ExecutionMode.Sequential, new Cmd_Function(()=>
{
Debug.Log("插队指令,抽牌");
Debug.Log("插队指令,抽牌");
}), new Cmd_DrawCards(user.deckSubmodule, 1));
firstGroup.insertAtFirst = true;

View File

@@ -16,8 +16,6 @@ namespace Continentis.Mods.Basic.Cards
protected override List<CommandBase> PlayEffect(List<CharacterBase> targetList)
{
base.PlayEffect(targetList);
CommandGroup mainGroup = TargetListCommandGroup(targetList,
new Cmd_PlayAnimation(user.characterView, "Attack"),
new Cmd_ParamFunction<CharacterBase>(target =>

View File

@@ -1,18 +1,32 @@
using Continentis.MainGame;
using Continentis.MainGame.Character;
using SLSFramework.General;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
public class WoundDeterioration : CharacterCombatBuffBase
{
public WoundDeterioration(int stack)
private int damageCount;
public WoundDeterioration(int stack, int damageCount)
{
Initialize(BuffType.Positive, BuffDispelLevel.Basic);
this.damageCount = damageCount;
this.contentSubmodule = new ContentSubmodule(this)
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString())
.AddParameterGetter("DamageCount", damageCount.ToString);
this.iconSubmodule = new IconSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onDealAttack.Add("WoundDeterioration", new PrioritizedAction<AttackResult>(atkRes =>
{
if (atkRes.hurtDamage >= 20)
{
CreateCharacterBuff<Corrosion>(this.unitedStackSubmodule.stackAmount).Apply(atkRes.target, atkRes.attacker);
}
}));
//TODO: When character damage exceed 20, apply corrision
//this.attachedCharacter.eventSubmodule.onFinishAttack.Add;
}
@@ -23,8 +37,10 @@ namespace Continentis.Mods.Basic.Buffs
if (FindExistingSameBuff(out existingBuff))
{
WoundDeterioration existing = existingBuff as WoundDeterioration;
existingBuff.unitedStackSubmodule.PickHigherStack(this.unitedStackSubmodule);
existingBuff.actionCountSubmodule.PickHigherCount(this.actionCountSubmodule);
existing!.damageCount = Mathf.Min(existing.damageCount, this.damageCount);
return false;
}

View File

@@ -28,7 +28,7 @@ namespace Continentis.Mods.Basic.Buffs
private void OnGetAttacked(AttackResult result)
{
int stackAmount = unitedStackSubmodule.stackAmount;
result.attacker.Attack(attachedCharacter, stackAmount, false, true);
result.attacker.Attack(attachedCharacter, stackAmount, null, false, true);
}
private void OnActionStart()

View File

@@ -46,7 +46,7 @@ namespace Continentis.Mods.Basic.Buffs
private void OnAfterPlayCard(CardInstance card, List<CharacterBase> targets)
{
sourceCharacter.Attack(attachedCharacter, unitedStackSubmodule.stackAmount, false, true);
sourceCharacter.Attack(attachedCharacter, unitedStackSubmodule.stackAmount, null, false, true);
}
}
}

View File

@@ -38,7 +38,7 @@ namespace Continentis.Mods.Basic.Buffs
private void OnActionStart()
{
sourceCharacter.Attack(attachedCharacter, unitedStackSubmodule.stackAmount, false, true);
sourceCharacter.Attack(attachedCharacter, unitedStackSubmodule.stackAmount, null, false, true);
unitedStackSubmodule.ReduceStack(1);
iconSubmodule.Update();
}

View File

@@ -24,7 +24,7 @@ namespace Continentis.Mods.Basic.Buffs
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onGetAttacked.Add("EstablishFormation", new PrioritizedAction<AttackResult>(atkResult =>
{
attachedCharacter.Attack(atkResult.attacker, unitedStackSubmodule.stackAmount, false, true);
attachedCharacter.Attack(atkResult.attacker, unitedStackSubmodule.stackAmount, null, false, true);
}));
}

View File

@@ -40,7 +40,7 @@ namespace Continentis.Mods.Basic.Buffs
private void OnAfterPlayCard(CardInstance card, List<CharacterBase> targets)
{
int reducedStack = Mathf.Max(1, Mathf.FloorToInt(unitedStackSubmodule.stackAmount * 0.2f));
sourceCharacter.Attack(attachedCharacter, reducedStack, true);
sourceCharacter.Attack(attachedCharacter, reducedStack, null, true);
unitedStackSubmodule.ReduceStack(reducedStack);
iconSubmodule.Update();
}

View File

@@ -206,5 +206,6 @@ MonoBehaviour:
- CardData_Basic_Torture
- CardData_Basic_CompoundPosion
- CardData_Basic_WoundDeterioration
- CardData_Basic_DivineSmite
hudDataRefs:
- HUDData_Basic_Default

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

View File

@@ -0,0 +1,119 @@
fileFormatVersion: 2
guid: ad17795194f70134c997e767d8f2f45a
labels:
- UnityAI
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 1024
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 256
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2630,7 +2630,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 960.00006, y: -60.445}
m_AnchoredPosition: {x: 960, y: -60.445}
m_SizeDelta: {x: 500.07, y: 80.89}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1914150234

View File

@@ -128,6 +128,7 @@ namespace Continentis.MainGame
public OrderedDictionary<string, PrioritizedAction<CharacterBase, IntendedCard, CharacterBase>> onOpponentDecideAction; //对手AI决定行动时参数为对手和原定的目标角色
public OrderedDictionary<string, PrioritizedAction<AttackResult>> onDealAttack; //造成伤害后,参数为伤害结果
public OrderedDictionary<string, PrioritizedAction<AttackResult>> onGetAttacked; //被攻击后,参数为伤害结果
public OrderedDictionary<string, PrioritizedAction<CardInstance>> onDrawCard; //抽到卡牌时
@@ -147,6 +148,7 @@ namespace Continentis.MainGame
onActionStart = new OrderedDictionary<string, PrioritizedAction>();
onActionEnd = new OrderedDictionary<string, PrioritizedAction>();
onDealAttack = new OrderedDictionary<string, PrioritizedAction<AttackResult>>();
onGetAttacked = new OrderedDictionary<string, PrioritizedAction<AttackResult>>();
onOpponentDecideAction = new OrderedDictionary<string, PrioritizedAction<CharacterBase, IntendedCard, CharacterBase>>();

View File

@@ -76,10 +76,13 @@ namespace Continentis.MainGame.Character
/// <param name="ignoreBlock">是否无视格挡</param>
/// <param name="ignoreShield">是否无视护盾</param>
/// <returns>实际造成的伤害</returns>
public AttackResult Attack(CharacterBase target, int startDamage, bool triggerAttackEvent = true, bool ignoreDodge = false, bool ignoreBlock = false, bool ignoreShield = false)
public AttackResult Attack(CharacterBase target, int startDamage, CardInstance attackCard = null, bool triggerAttackEvent = true, bool ignoreDodge = false, bool ignoreBlock = false, bool ignoreShield = false)
{
eventSubmodule.onStartAttack.Invoke(new List<CharacterBase> { target });
if (triggerAttackEvent)
{
eventSubmodule.onStartAttack.Invoke(target);
}
//闪避检测:如果闪避成功,直接结束
int modifiedStartDamageForDodge = Mathf.RoundToInt(startDamage * GetRawAttribute("DodgeCheckStartDamageMultiplier", 1));
bool dodged = !ignoreDodge && target.CheckDodge(modifiedStartDamageForDodge);
@@ -105,10 +108,14 @@ namespace Continentis.MainGame.Character
}
target.characterView.hudContainer.enablingHUDs["MainAttributesBar"].UpdateHud();
AttackResult attackResult = new AttackResult(this, startDamage, dodged, blocked, shielded, hurt);
AttackResult attackResult = new AttackResult(this, target, startDamage, attackCard, dodged, blocked, shielded, hurt);
if (triggerAttackEvent)
{
eventSubmodule.onFinishAttack.Invoke(new List<CharacterBase> { target }, new List<AttackResult> { attackResult });
eventSubmodule.onFinishAttack.Invoke(target, attackResult);
combatBuffSubmodule.buffList.For(buff =>
{
buff.eventSubmodule.onDealAttack.Invoke(attackResult);
});
}
return attackResult;

View File

@@ -14,8 +14,8 @@ namespace Continentis.MainGame.Character
public OrderedDictionary<string, PrioritizedAction> onRoundStart; //每回合开始时
public OrderedDictionary<string, PrioritizedAction> onRoundEnd; //每回合结束时
public OrderedDictionary<string, PrioritizedAction<List<CharacterBase>>> onStartAttack; //开始攻击时,参数为被攻击目标列表
public OrderedDictionary<string, PrioritizedAction<List<CharacterBase>, List<AttackResult>>> onFinishAttack; //完成攻击时,参数为被攻击目标列表和对应的攻击结果列表
public OrderedDictionary<string, PrioritizedAction<CharacterBase>> onStartAttack; //开始攻击时,参数为被攻击目标
public OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>> onFinishAttack; //完成攻击时,参数为被攻击目标和对应的攻击结果
public OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>> onGetAttacked; //被攻击时,参数为攻击者和攻击结果
public OrderedDictionary<string, PrioritizedAction> onActionStart; //每次行动开始时
@@ -35,8 +35,8 @@ namespace Continentis.MainGame.Character
onActionStart = new OrderedDictionary<string, PrioritizedAction>();
onActionEnd = new OrderedDictionary<string, PrioritizedAction>();
onStartAttack = new OrderedDictionary<string, PrioritizedAction<List<CharacterBase>>>();
onFinishAttack = new OrderedDictionary<string, PrioritizedAction<List<CharacterBase>, List<AttackResult>>>();
onStartAttack = new OrderedDictionary<string, PrioritizedAction<CharacterBase>>();
onFinishAttack = new OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>>();
onGetAttacked = new OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>>();
onBeforePlayCard = new OrderedDictionary<string, PrioritizedAction<CardInstance, List<CharacterBase>>>();
@@ -82,6 +82,8 @@ namespace Continentis.MainGame.Character
public class AttackResult
{
public CharacterBase attacker; //攻击者
public CharacterBase target; //被攻击者
public CardInstance attackCard; //使用的攻击卡牌
public int startDamage; //攻击开始时的原始伤害值
public bool isDodged; //是否被闪避
public int blockedDamage; //格挡掉的伤害
@@ -90,9 +92,11 @@ namespace Continentis.MainGame.Character
public bool IsHurt => hurtDamage > 0; //是否实际受到伤害
public AttackResult(CharacterBase attacker, int startDamage, bool isDodged, int blocked, int shielded, int hurt)
public AttackResult(CharacterBase attacker, CharacterBase target, int startDamage, CardInstance attackCard, bool isDodged, int blocked, int shielded, int hurt)
{
this.attacker = attacker;
this.target = target;
this.attackCard = attackCard;
this.startDamage = startDamage;
this.isDodged = isDodged;
this.blockedDamage = blocked;

View File

@@ -67,6 +67,9 @@ namespace Continentis.Mods
[Button]
private void CollectAllHUDData() => hudDataIDList = CollectData<HUDData>();
[Button]
private void CollectAllLocalizations() => localizationFiles = CollectLocalizations();
}
public partial class ModManifest
@@ -97,6 +100,30 @@ namespace Continentis.Mods
Debug.Log($"Collected {collectedDataIDList.Count} CardData assets.");
return collectedDataIDList;
}
private List<TextAsset> CollectLocalizations()
{
string inEditorModPath = "Assets/Mods/" + inEditorModFolder;
string dataTypeName = nameof(TextAsset);
string[] guids = UnityEditor.AssetDatabase.FindAssets($"t:{dataTypeName}", new[] { inEditorModPath });
List<TextAsset> collectedTextAssets = new List<TextAsset>();
Debug.Log($"Found {guids.Length} TextAsset assets.");
foreach (string guid in guids)
{
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(guid);
string assetFileName = System.IO.Path.GetFileNameWithoutExtension(path);
TextAsset data = UnityEditor.AssetDatabase.LoadAssetAtPath<TextAsset>(path);
if (assetFileName.Contains("Localization"))
{
collectedTextAssets.Add(data);
Debug.Log($"Collected localization TextAsset: {assetFileName}");
}
}
Debug.Log($"Collected {collectedTextAssets.Count} localization TextAssets.");
return collectedTextAssets;
}
}
#endif
}