SRPG游戏开发(三十九)第九章 战斗系统 - 一 战斗属性(Combat Properties)

SRPG游戏开发(十六)第六章 基本框架 - 一 本章简介(Introduction) 返回目录 第六章 基本框架(Framework) 这一章主要编写各个游戏都有的基本框架。 关于源码、打包好的dll文件还没有上传,如何使用它们的Example工程也没有上传。 先来介绍一下源码的各个文件,有个初步认识。 一 源码文件介绍 Author: DarKRabbit Blog: CSDN The introduction of files. 文件介绍 Si... 阅读详情

返回总目录

第九章 战斗系统(Combat System)

在SRPG中,大多数情况是指角色与角色之间的战斗。而这种战斗一般有两种模式:

  • 地图中直接战斗;

  • 有专门的战斗场景。

这两种模式的战斗在数据上没有任何区别,只有战斗动画的区别。

就像之前描述的,SRPG也是RPG,所以战斗方式和回合制RPG的战斗几乎是相同的。主要区别是RPG每个回合需要手动操作(也有自动战斗的),直到战斗结束;而SRPG是自动战斗,且多数情况只有一个回合(额外回合也是由于技能、物品或剧情需要)。且RPG多数是多人战斗,而SRPG多数是每边就一个。

我们这一章就来写一个战斗系统。



一 战斗属性(Combat Properties)

战斗中需要的属性是需要从我们的角色身上获取的。

我们在这里还是拿《FE4》来举例,在《FE4》中的基础战斗属性包含:

  • 物理攻击力(attack) = 武器攻击力 + 角色力量(STR) + 道具力量

  • 魔法攻击力(mage attack) = 武器攻击力 + 角色魔力(MAG) + 道具魔力

  • 物理防御力(defence) = 角色防御(DEF) + 道具防御

  • 魔法防御力(mage defence) = 角色魔防(MDF) + 道具魔防

  • 攻速(speed) = 角色速度(SPD) + 道具速度 - 武器重量(weight)

  • 命中(hit rate) = (角色技巧(SKL) + 道具技巧) * 2 + 武器命中(hit rate)

  • 回避(avoidance) = (角色速度 + 道具速度) * 2 + 角色幸运 + 道具幸运

  • 爆击(crit):暂不考虑

  • 攻击范围(attack range):来自武器

  • 生命值(hp)与最大生命值(max hp)

了解这些后,我们来实现它们。


1 角色战斗属性(Role Fight Properties)

经过之前的分析,我们的角色需要一些战斗属性;而属性是需要计算的。而在属性中,我们需要装备的属性(装备的武器和饰品)。

1.1 物品属性叠加(Sum of Item Properties)

我们在Role类中添加计算属性叠加方法:

        /// <summary>
        /// 物品属性叠加
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public int GetItemFightPropertySum(FightPropertyType type)
        {
   
   
            if (type == FightPropertyType.MaxLength)
            {
   
   
                return 0;
            }

            int value = 0;

            // 如果装备武器不为null,则叠加武器属性
            if (equipedWeapon != null)
            {
   
   
                value += equipedWeapon.uniqueInfo.fightProperties[type];
            }

            // 叠加所有饰品属性
            foreach (Item item in items)
            {
   
   
                if (item != null && item.itemType == ItemType.Ornament)
                {
   
   
                    value += (item as Ornament).uniqueInfo.fightProperties[type];
                }
            }

            return value;
        }

添加Luk叠加方法:

        /// <summary>
        /// 物品幸运叠加
        /// </summary>
        /// <returns></returns>
        public int GetItemLukSum()
        {
   
   
            int value = 0;

            // 如果装备武器不为null,则叠加武器幸运
            if (equipedWeapon != null)
            {
   
   
                value += equipedWeapon.uniqueInfo.luk;
            }

            // 叠加所有饰品幸运
            foreach (Item item in items)
            {
   
   
                if (item != null && item.itemType == ItemType.Ornament)
                {
   
   
                    value += (item as Ornament).uniqueInfo.luk;
                }
            }

            return value;
        }
1.2 战斗属性(Fight Properties)

有了叠加属性的方法后,我们来添加战斗中需要的属性:

        /// <summary>
        /// 物理攻
UE4构建硬核战斗与无缝随机关卡:《生死轮回》的设计与Gameplay技术实现 【笔记】 游戏介绍: 《生死轮回》是一款基于虚幻引擎4开发的Cyberpunk题材横版Roguelite动作游戏。这款游戏基于C++和Blueprints进行Gameplay与功能开发。 视频的内容由两部分构成: 结合这款游戏,介绍"战斗系统"和"无缝随机地图"的设计及实现技术细节。 作为制作人和Gameplay程序员,李伟将遵循自己在游戏开发过程中的路径展开讨论:从简单的单点功能设计到技术实现细节,到各模块的内容交汇在一起构成复杂的游戏性系统。 正文: 战斗系统 主要讲“近战武器”+“受击者反 阅读详情

相关推荐

战斗系统之属性设计(一)

一切属性均为属性 在战斗系统中,包含不同种类的属性。 比如:血量、攻击力、防御力、暴击率、格挡率、格挡系数等常规属性 再如:是否被眩晕、是否物理免疫、是否无敌等状态属性 三如:标记死亡、标记出生、技能CD缩减等逻辑属性 四如:当前位置、召唤者、召唤单位等对象属性 我们在常规的设计中往往只对常规属性做统一处理,部分也会统一处理状态属性,但很少的会把其他的属性也纳入进来。在此,我们不讨论对错,只对比2...

Feng0_0zi的专栏 1776

SRPG游戏开发(四十)第九章 战斗系统 - 二 计算战斗数据(Calculate Combat Data)

1 角色战斗变量;2 战斗每一步;3 战斗;4 测试战斗数据。

DarkRabbit的专栏 1829

战斗系统设计(44页)

“ 最佳的物理反馈, 卓越的打击感, 爽快的连击, 刺激的视听表现!” 这是 RBS 所追求的目标, 要实现这些目标, 需要一些更细节的设计, 在整个操作和判定上将会很复杂. 在用户的体验上, 攻击/ 连击是简单的( 广度), 但 闪躲/ 反制/ 高连击是需要技巧的( 深度), 以此扩大用户面. 并培养核 心向用户. RBS 是 是 S 里最有难度的系统! 也是最核心的系统! 是对程序和动作一次巨大的挑战! 以下将会有非常详细的操作, 动作图示以及说明.

unity3D战旗类回合制格斗游戏源码

unity3d回合制格斗游戏源码 Turn Based Battle System 非常棒的一个项目,是战旗类游戏和格斗游戏的合体,两种游戏的各项功能都具备,支持人机对、机器对机器、双人模式

基于STM32的智能停车场管理系统

随着城市车辆数量激增,传统停车场管理效率低下。本文设计了一款基于STM32的智能停车场管理系统,支持车牌识别、车位引导、自动计费等功能,可显著提升停车场运营效率。系统适用于商场、小区等场景,支持多终端协同管理。本系统实现了停车场智能化管理,显著提升了运营效率。:STM32F746(高性能Cortex-M7)问题讨论,stm32的资料领取可以私信!:OV7725摄像头(30fps):ESP32(Wi-Fi+蓝牙)红外对射传感器(车辆进出检测)支持蓝牌、黄牌、新能源车牌。⬇帮大家整理了单片机的资料。

stm32d1219的博客 880

ROS2学习笔记(二)-- 多机通讯原理简介及配置方法

简单介绍ROS2多机通信原理以及配置注意事项

aibingjin的博客 1万+

《全连接到卷积神经网络:图像识别的演变历程》

这篇文章会从传统全连接层面临的困境说起,揭示卷积神经网络(CNN)成为图像识别核心动力的原因,探究其背后蕴含的设计思想与技术创新。但是回顾历史,CNN的出现提醒我们:技术的突破往往是由对自然规律的模仿和重新构建得来的。也许,当机器真的学会“像人一样看世界”的时候,它们的“眼睛”早就超过生物视觉的限制了。例如,用5×5的核处理224×224的输入时,只要25个参数(而不是全连接那种百万级的)。* 局部性:网络的底层只需留意局部的地方(像边缘、纹理这样的地方),不用管那些全局像素之间复杂的关系。

2401_82434295的博客 679

Cadence OrCAD常见引脚错误排查指南:从原理图到封装的完整解决方案

本文详细解析Cadence OrCAD设计中常见的引脚错误问题,提供从原理图到封装的系统化解决方案。涵盖错误诊断、元件库修复、封装管理及自动化处理技巧,帮助工程师高效解决ORCAP-36022等典型错误,确保设计流程顺畅。

weixin_29294975的博客 263

2025.05.28【读书笔记】|如何用SILVA和RFAM数据库高效去除rRNA污染

摘要: 在Ribo-seq等测序数据分析中,清除rRNA污染对结果准确性至关重要。仅使用SILVA数据库可能遗漏5S rRNA污染,建议结合RFAM数据库(特别是RF00001家族)全面清除。操作要点包括:下载两库序列、将RNA碱基U替换为DNA的T、合并序列建立索引,使用bowtie2过滤rRNA reads。注意U/T转换是关键,否则会导致比对失败。该方法能有效提升数据清洁度,为后续分析奠定基础。

985

Python爬虫案例——解密抓取西红柿小说《我不是戏神》全章节!!!

本文介绍了抓取番茄小说网站《我不是戏神》全本内容的完整流程。首先分析网站反爬机制,发现采用自定义混淆字体加密文本内容。通过下载字体文件并解析字符映射关系,组建本地字体映射表。随后编写Python爬虫程序,实现自动获取章节链接、请求加密内容、解密替换字体、保存为本地txt文件等功能。代码包含UA伪装、请求头设置、进度条显示等细节处理,最终实现小说内容的完整抓取与解密存储。

@CSDN盲敲代码的阿豪的博客 668

解释多智能体强化学习(Multi-Agent Reinforcement Learning)(面试题200合集,中频、重要)

多智能体强化学习通过扩展传统强化学习框架,研究多个智能体在动态、交互环境中的策略优化问题。它既有理论上的挑战(如非平稳性和均衡求解),也有广泛的实际应用前景。数学上,它依赖马尔可夫博弈模型,核心是设计算法让智能体在合作或竞争中达到最优。

qq_38334677的博客 993

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

上一篇: LeetCode Algorithm 0051 - 0055
下一篇: SRPG游戏开发(四十)第九章 战斗系统 - 二 计算战斗数据(Calculate Combat Data)
沙沙的兔子
博客等级 码龄17年 360粉丝 135原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值