Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mr BigSock
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gard Aleksander Furre
Mr BigSock
Commits
5dad49ac
Commit
5dad49ac
authored
2 years ago
by
Robin Halseth Sandvik
Browse files
Options
Downloads
Patches
Plain Diff
Implemented mana, stamina & hp costs.
parent
e0758553
No related branches found
Branches containing commit
No related tags found
1 merge request
!31
Mana and stamina.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs
+23
-0
23 additions, 0 deletions
MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs
MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs
+18
-0
18 additions, 0 deletions
MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs
with
41 additions
and
0 deletions
MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs
+
23
−
0
View file @
5dad49ac
...
@@ -43,6 +43,23 @@ namespace BigSock {
...
@@ -43,6 +43,23 @@ namespace BigSock {
/*
The mana cost of the ability.
*/
public
float
ManaCost
{
get
;
protected
set
;
}
/*
The stamina cost of the ability.
*/
public
float
StaminaCost
{
get
;
protected
set
;
}
/*
The hp cost of the ability.
*/
public
float
HPCost
{
get
;
protected
set
;
}
/*
/*
...
@@ -54,6 +71,9 @@ namespace BigSock {
...
@@ -54,6 +71,9 @@ namespace BigSock {
// Check that the ability is cooled down.
// Check that the ability is cooled down.
if
(
Ready
)
{
if
(
Ready
)
{
//> Handle checking costs here.
//> Handle checking costs here.
if
(
ManaCost
>
0f
&&
actor
.
Mana
<
ManaCost
)
return
false
;
if
(
StaminaCost
>
0f
&&
actor
.
Stamina
<
StaminaCost
)
return
false
;
if
(
HPCost
>
0f
&&
actor
.
HP
<
HPCost
)
return
false
;
// Activate the ability.
// Activate the ability.
var
res
=
Activate
(
actor
,
target
);
var
res
=
Activate
(
actor
,
target
);
...
@@ -62,6 +82,9 @@ namespace BigSock {
...
@@ -62,6 +82,9 @@ namespace BigSock {
if
(
res
)
{
if
(
res
)
{
NextTimeCanUse
=
DateTime
.
Now
+
Cooldown
;
NextTimeCanUse
=
DateTime
.
Now
+
Cooldown
;
//> Handle paying the cost (HP, mana, stamina) here.
//> Handle paying the cost (HP, mana, stamina) here.
if
(
ManaCost
>
0f
)
actor
.
Mana
-=
ManaCost
;
if
(
StaminaCost
>
0f
)
actor
.
Stamina
-=
StaminaCost
;
if
(
HPCost
>
0f
)
actor
.
HP
-=
HPCost
;
}
}
return
res
;
return
res
;
...
...
This diff is collapsed.
Click to expand it.
MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs
+
18
−
0
View file @
5dad49ac
...
@@ -42,6 +42,24 @@ namespace BigSock {
...
@@ -42,6 +42,24 @@ namespace BigSock {
bool
Ready
{
get
;
}
bool
Ready
{
get
;
}
/*
The mana cost of the ability.
*/
float
ManaCost
{
get
;
}
/*
The stamina cost of the ability.
*/
float
StaminaCost
{
get
;
}
/*
The hp cost of the ability.
*/
float
HPCost
{
get
;
}
/*
/*
-----------------------------
-----------------------------
Add in something for costs.
Add in something for costs.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment