Skip to content
Snippets Groups Projects
Commit 0a18697f authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Added new item that heals on kill.

parent f8221b1e
No related branches found
No related tags found
1 merge request!24PrefabService & abilities
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
namespace BigSock.Item {
/*
An item that heals the user on kill.
*/
public class ItemPlasticStraw : OnKillItemBase {
public override ulong Id => 202;
public override string Name => "Plastic Straw";
public override string Description => "Heal the user on kill.";
public static readonly double CHANCE = 1.0;
public override void Handler(Character source, Character target, AttackStats attack) {
// Check if it triggers.
var roll = RND.NextDouble();
if(roll <= CHANCE) {
MonoBehaviour.print($"[ItemPlasticStraw.Handler()] Hit. ({roll:P1} <= {CHANCE:P1})");
source.TryHeal(1.5f);
} else {
MonoBehaviour.print($"[ItemPlasticStraw.Handler()] Miss. ({roll:P1} > {CHANCE:P1})");
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: c24f1f2ed9cc63f4b9de7e0997060e4e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment